fix event type queries for pixels/links. remove hardcoded event types

This commit is contained in:
Francis Cao 2025-10-01 12:29:31 -07:00
parent f86c21b25b
commit 1809959b99
14 changed files with 42 additions and 51 deletions

View file

@ -1,7 +1,6 @@
import clickhouse from '@/lib/clickhouse';
import {
EMAIL_DOMAINS,
EVENT_TYPE,
PAID_AD_PARAMS,
SEARCH_DOMAINS,
SHOPPING_DOMAINS,
@ -26,7 +25,6 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
const { queryParams, filterQuery, joinSessionQuery, cohortQuery, dateQuery } = parseFilters({
...filters,
websiteId,
eventType: EVENT_TYPE.pageView,
});
return rawQuery(
@ -49,7 +47,8 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
from website_event
${cohortQuery}
${joinSessionQuery}
where website_id = {{websiteId::uuid}}
where website_event.website_id = {{websiteId::uuid}}
and website_event.event_type != 2
${dateQuery}
${filterQuery}
group by 1, 2
@ -74,7 +73,6 @@ async function clickhouseQuery(
const { queryParams, filterQuery, cohortQuery, dateQuery } = parseFilters({
...filters,
websiteId,
eventType: EVENT_TYPE.pageView,
});
const sql = `
@ -108,6 +106,7 @@ async function clickhouseQuery(
from website_event
${cohortQuery}
where website_id = {websiteId:UUID}
and event_type != 2
${dateQuery}
${filterQuery}
group by 1, 2