From 7a89bbf19f4bc7fcbe109249ef93c867d93545a2 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Thu, 22 Jan 2026 19:29:25 -0800 Subject: [PATCH] render links in event, session activity, realtime activity using hostname instead of domain. Closes #2861 --- .../websites/[websiteId]/events/EventsTable.tsx | 15 ++++++++++++++- .../[websiteId]/realtime/RealtimeLog.tsx | 13 ++++++++++--- .../[websiteId]/sessions/SessionActivity.tsx | 17 +++++++++++++++-- src/queries/sql/getRealtimeActivity.ts | 6 ++++-- src/queries/sql/sessions/getSessionActivity.ts | 2 ++ 5 files changed, 45 insertions(+), 8 deletions(-) diff --git a/src/app/(main)/websites/[websiteId]/events/EventsTable.tsx b/src/app/(main)/websites/[websiteId]/events/EventsTable.tsx index 7fb2eb41..41c2b1e8 100644 --- a/src/app/(main)/websites/[websiteId]/events/EventsTable.tsx +++ b/src/app/(main)/websites/[websiteId]/events/EventsTable.tsx @@ -25,6 +25,19 @@ export function EventsTable(props: DataTableProps) { const { updateParams } = useNavigation(); const { formatValue } = useFormat(); + const renderLink = (label: string, hostname: string) => { + return ( + + {label} + + ); + }; + return ( @@ -43,7 +56,7 @@ export function EventsTable(props: DataTableProps) { title={row.eventName || row.urlPath} truncate > - {row.eventName || row.urlPath} + {row.eventName || renderLink(row.urlPath, row.hostname)} {row.hasData > 0 && } diff --git a/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.tsx b/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.tsx index 10763618..9cbbd371 100644 --- a/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.tsx +++ b/src/app/(main)/websites/[websiteId]/realtime/RealtimeLog.tsx @@ -74,8 +74,9 @@ export function RealtimeLog({ data }: { data: any }) { os: string; country: string; device: string; + hostname: string; }) => { - const { __type, eventName, urlPath, browser, os, country, device } = log; + const { __type, eventName, urlPath, browser, os, country, device, hostname } = log; if (__type === TYPE_EVENT) { return ( @@ -86,7 +87,8 @@ export function RealtimeLog({ data }: { data: any }) { url: ( @@ -100,7 +102,12 @@ export function RealtimeLog({ data }: { data: any }) { if (__type === TYPE_PAGEVIEW) { return ( - + {urlPath} ); diff --git a/src/app/(main)/websites/[websiteId]/sessions/SessionActivity.tsx b/src/app/(main)/websites/[websiteId]/sessions/SessionActivity.tsx index cbb28108..df0ef834 100644 --- a/src/app/(main)/websites/[websiteId]/sessions/SessionActivity.tsx +++ b/src/app/(main)/websites/[websiteId]/sessions/SessionActivity.tsx @@ -39,10 +39,23 @@ export function SessionActivity({ const { isMobile } = useMobile(); let lastDay = null; + const renderLink = (label: string, hostname: string) => { + return ( + + {label} + + ); + }; + return ( - {data?.map(({ eventId, createdAt, urlPath, eventName, visitId, hasData }) => { + {data?.map(({ eventId, createdAt, urlPath, eventName, visitId, hostname, hasData }) => { const showHeader = !lastDay || !isSameDay(new Date(lastDay), new Date(createdAt)); lastDay = createdAt; @@ -61,7 +74,7 @@ export function SessionActivity({ : formatMessage(labels.viewedPage)} - {eventName || urlPath} + {eventName || renderLink(urlPath, hostname)} {hasData > 0 && } diff --git a/src/queries/sql/getRealtimeActivity.ts b/src/queries/sql/getRealtimeActivity.ts index 075b65e2..c847b6f7 100644 --- a/src/queries/sql/getRealtimeActivity.ts +++ b/src/queries/sql/getRealtimeActivity.ts @@ -30,7 +30,8 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) { session.device, session.country, website_event.url_path as "urlPath", - website_event.referrer_domain as "referrerDomain" + website_event.referrer_domain as "referrerDomain", + website_event.hostname from website_event ${cohortQuery} inner join session @@ -65,7 +66,8 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters): Promis device, country, url_path as urlPath, - referrer_domain as referrerDomain + referrer_domain as referrerDomain, + hostname from website_event ${cohortQuery} where website_id = {websiteId:UUID} diff --git a/src/queries/sql/sessions/getSessionActivity.ts b/src/queries/sql/sessions/getSessionActivity.ts index af31fca6..1ac7e6ff 100644 --- a/src/queries/sql/sessions/getSessionActivity.ts +++ b/src/queries/sql/sessions/getSessionActivity.ts @@ -29,6 +29,7 @@ async function relationalQuery(websiteId: string, sessionId: string, filters: Qu event_type as "eventType", event_name as "eventName", visit_id as "visitId", + hostname, event_id IN (select website_event_id from event_data where website_id = {{websiteId::uuid}} @@ -60,6 +61,7 @@ async function clickhouseQuery(websiteId: string, sessionId: string, filters: Qu event_type as eventType, event_name as eventName, visit_id as visitId, + hostname, event_id IN (select event_id from event_data where website_id = {websiteId:UUID}