Add Session Activity guards for showing multiple records per result

This commit is contained in:
Francis Cao
2026-06-10 09:18:25 -07:00
parent 8227589ad9
commit f9cf213261
+11 -11
View File
@@ -70,16 +70,16 @@ async function clickhouseQuery(websiteId: string, sessionId: string) {
return rawQuery(
`
select id,
websiteId,
distinctId,
browser,
os,
device,
screen,
language,
country,
region,
city,
any(websiteId) as websiteId,
argMax(distinctId, max_time) as distinctId,
argMax(browser, max_time) as browser,
argMax(os, max_time) as os,
argMax(device, max_time) as device,
argMax(screen, max_time) as screen,
argMax(language, max_time) as language,
argMax(country, max_time) as country,
argMax(region, max_time) as region,
argMax(city, max_time) as city,
${getDateStringSQL('min(min_time)')} as firstAt,
${getDateStringSQL('max(max_time)')} as lastAt,
uniq(visit_id) visits,
@@ -108,7 +108,7 @@ async function clickhouseQuery(websiteId: string, sessionId: string) {
and session_id = {sessionId:UUID}
and event_type != ${EVENT_TYPE.performance}
group by session_id, distinct_id, visit_id, website_id, browser, os, device, screen, language, country, region, city) t
group by id, websiteId, distinctId, browser, os, device, screen, language, country, region, city;
group by id;
`,
{ websiteId, sessionId },
FUNCTION_NAME,