11import clickhouse from '@/lib/clickhouse' ;
2- import { EVENT_TYPE } from '@/lib/constants' ;
2+ import { EVENT_COLUMNS } from '@/lib/constants' ;
33import { CLICKHOUSE , PRISMA , runQuery } from '@/lib/db' ;
44import prisma from '@/lib/prisma' ;
55import { QueryFilters } from '@/lib/types' ;
6- import { EVENT_COLUMNS } from '@/lib/constants' ;
76
87const FUNCTION_NAME = 'getWebsiteStats' ;
98
@@ -32,7 +31,6 @@ async function relationalQuery(
3231 const { filterQuery, joinSessionQuery, cohortQuery, queryParams } = parseFilters ( {
3332 ...filters ,
3433 websiteId,
35- eventType : EVENT_TYPE . pageView ,
3634 } ) ;
3735
3836 return rawQuery (
@@ -55,6 +53,7 @@ async function relationalQuery(
5553 ${ joinSessionQuery }
5654 where website_event.website_id = {{websiteId::uuid}}
5755 and website_event.created_at between {{startDate}} and {{endDate}}
56+ and website_event.event_type != 2
5857 ${ filterQuery }
5958 group by 1, 2
6059 ) as t
@@ -72,7 +71,6 @@ async function clickhouseQuery(
7271 const { filterQuery, cohortQuery, queryParams } = parseFilters ( {
7372 ...filters ,
7473 websiteId,
75- eventType : EVENT_TYPE . pageView ,
7674 } ) ;
7775
7876 let sql = '' ;
@@ -96,6 +94,7 @@ async function clickhouseQuery(
9694 ${ cohortQuery }
9795 where website_id = {websiteId:UUID}
9896 and created_at between {startDate:DateTime64} and {endDate:DateTime64}
97+ and event_type != 2
9998 ${ filterQuery }
10099 group by session_id, visit_id
101100 ) as t;
@@ -118,6 +117,7 @@ async function clickhouseQuery(
118117 ${ cohortQuery }
119118 where website_id = {websiteId:UUID}
120119 and created_at between {startDate:DateTime64} and {endDate:DateTime64}
120+ and event_type != 2
121121 ${ filterQuery }
122122 group by session_id, visit_id
123123 ) as t;
0 commit comments