diff --git a/src/app/(main)/websites/[websiteId]/WebsiteExpandedMenu.tsx b/src/app/(main)/websites/[websiteId]/WebsiteExpandedMenu.tsx
index 29c3954f..4bac4ff6 100644
--- a/src/app/(main)/websites/[websiteId]/WebsiteExpandedMenu.tsx
+++ b/src/app/(main)/websites/[websiteId]/WebsiteExpandedMenu.tsx
@@ -169,6 +169,12 @@ export function WebsiteExpandedMenu({
path: updateParams({ view: 'hostname' }),
icon: ,
},
+ {
+ id: 'distinctId',
+ label: formatMessage(labels.distinctId),
+ path: updateParams({ view: 'distinctId' }),
+ icon: ,
+ },
{
id: 'tag',
label: formatMessage(labels.tag),
diff --git a/src/app/(main)/websites/[websiteId]/compare/CompareTables.tsx b/src/app/(main)/websites/[websiteId]/compare/CompareTables.tsx
index 13c05160..4daf17fc 100644
--- a/src/app/(main)/websites/[websiteId]/compare/CompareTables.tsx
+++ b/src/app/(main)/websites/[websiteId]/compare/CompareTables.tsx
@@ -93,6 +93,11 @@ export function CompareTables({ websiteId }: { websiteId: string }) {
label: formatMessage(labels.hostname),
path: renderPath('hostname'),
},
+ {
+ id: 'distinctId',
+ label: formatMessage(labels.distinctId),
+ path: renderPath('distinctId'),
+ },
{
id: 'tag',
label: formatMessage(labels.tags),
diff --git a/src/components/hooks/useFields.ts b/src/components/hooks/useFields.ts
index 22a1dcf3..039b7157 100644
--- a/src/components/hooks/useFields.ts
+++ b/src/components/hooks/useFields.ts
@@ -15,6 +15,7 @@ export function useFields() {
{ name: 'region', type: 'string', label: formatMessage(labels.region) },
{ name: 'city', type: 'string', label: formatMessage(labels.city) },
{ name: 'hostname', type: 'string', label: formatMessage(labels.hostname) },
+ { name: 'distinctId', type: 'string', label: formatMessage(labels.distinctId) },
{ name: 'tag', type: 'string', label: formatMessage(labels.tag) },
{ name: 'event', type: 'string', label: formatMessage(labels.event) },
];
diff --git a/src/components/hooks/useFilterParameters.ts b/src/components/hooks/useFilterParameters.ts
index 54032120..c141a3be 100644
--- a/src/components/hooks/useFilterParameters.ts
+++ b/src/components/hooks/useFilterParameters.ts
@@ -18,6 +18,7 @@ export function useFilterParameters() {
event,
tag,
hostname,
+ distinctId,
page,
pageSize,
search,
@@ -42,6 +43,7 @@ export function useFilterParameters() {
event,
tag,
hostname,
+ distinctId,
search,
segment,
cohort,
@@ -61,6 +63,7 @@ export function useFilterParameters() {
event,
tag,
hostname,
+ distinctId,
page,
pageSize,
search,
diff --git a/src/components/input/FilterEditForm.tsx b/src/components/input/FilterEditForm.tsx
index 44f43844..9221e3a2 100644
--- a/src/components/input/FilterEditForm.tsx
+++ b/src/components/input/FilterEditForm.tsx
@@ -61,7 +61,9 @@ export function FilterEditForm({ websiteId, onChange, onClose }: FilterEditFormP
websiteId={websiteId}
value={currentFilters}
onChange={setCurrentFilters}
- exclude={excludeFilters ? ['path', 'title', 'hostname', 'tag', 'event'] : []}
+ exclude={
+ excludeFilters ? ['path', 'title', 'hostname', 'distinctId', 'tag', 'event'] : []
+ }
/>
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index bfc80a13..3da177c0 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -55,6 +55,7 @@ export const SESSION_COLUMNS = [
'country',
'city',
'region',
+ 'distinctId',
];
export const SEGMENT_TYPES = {
@@ -69,6 +70,7 @@ export const FILTER_COLUMNS = {
referrer: 'referrer_domain',
domain: 'referrer_domain',
hostname: 'hostname',
+ distinctId: 'distinct_id',
title: 'page_title',
query: 'url_query',
os: 'os',
diff --git a/src/lib/schema.ts b/src/lib/schema.ts
index 247a89ae..a3c56a0f 100644
--- a/src/lib/schema.ts
+++ b/src/lib/schema.ts
@@ -36,6 +36,7 @@ export const filterParams = {
city: z.string().optional(),
tag: z.string().optional(),
hostname: z.string().optional(),
+ distinctId: z.string().optional(),
language: z.string().optional(),
event: z.string().optional(),
segment: z.uuid().optional(),
@@ -89,6 +90,7 @@ export const fieldsParam = z.enum([
'city',
'tag',
'hostname',
+ 'distinctId',
'language',
'event',
]);
diff --git a/src/queries/sql/events/getEventExpandedMetrics.ts b/src/queries/sql/events/getEventExpandedMetrics.ts
index dec444e8..86bda850 100644
--- a/src/queries/sql/events/getEventExpandedMetrics.ts
+++ b/src/queries/sql/events/getEventExpandedMetrics.ts
@@ -72,6 +72,7 @@ async function relationalQuery(
${filterQuery}
group by name, website_event.session_id, website_event.visit_id
) as t
+ where name != ''
group by name
order by visitors desc, visits desc
limit ${limit}
diff --git a/src/queries/sql/sessions/getSessionExpandedMetrics.ts b/src/queries/sql/sessions/getSessionExpandedMetrics.ts
index c8d20d84..6b85cd45 100644
--- a/src/queries/sql/sessions/getSessionExpandedMetrics.ts
+++ b/src/queries/sql/sessions/getSessionExpandedMetrics.ts
@@ -82,6 +82,7 @@ async function relationalQuery(
group by name, website_event.session_id, website_event.visit_id
${includeCountry ? ', country' : ''}
) as t
+ where name != ''
group by name
${includeCountry ? ', country' : ''}
order by visitors desc, visits desc