Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Updated query parameters.

Mike Cao7764f0ee26e8
diff --git a/queries/analytics/events/getEventMetrics.ts b/queries/analytics/events/getEventMetrics.ts
index e1312ee17..2e63accc7 100644
--- a/queries/analytics/events/getEventMetrics.ts
+++ b/queries/analytics/events/getEventMetrics.ts
@@ -60,12 +60,12 @@ async function relationalQuery(
where website_id = {{websiteId::uuid}}
and created_at >= {{resetDate}}
and created_at between {{startDate}} and {{endDate}}
- and event_type = ${EVENT_TYPE.customEvent}
+ and event_type = {{eventType}}
${filterQuery}
group by 1, 2
order by 2
`,
- { ...filters, websiteId, resetDate, startDate, endDate },
+ { ...filters, websiteId, resetDate, startDate, endDate, eventType: EVENT_TYPE.customEvent },
);
}
@@ -101,13 +101,13 @@ async function clickhouseQuery(
count(*) y
from website_event
where website_id = {websiteId:UUID}
- and event_type = ${EVENT_TYPE.customEvent}
and created_at >= {resetDate:DateTIme}
and created_at between {startDate:DateTime} and {endDate:DateTime}
+ and event_type = {eventType:UInt32}
${filterQuery}
group by x, t
order by t
`,
- { ...filters, websiteId, resetDate, startDate, endDate },
+ { ...filters, websiteId, resetDate, startDate, endDate, eventType: EVENT_TYPE.customEvent },
);
}
diff --git a/queries/analytics/events/getEvents.ts b/queries/analytics/events/getEvents.ts
index 5bf441e37..2169ee611 100644
--- a/queries/analytics/events/getEvents.ts
+++ b/queries/analytics/events/getEvents.ts
@@ -36,9 +36,9 @@ function clickhouseQuery(websiteId: string, startAt: Date, eventType: number) {
referrer_domain as referrerDomain,
event_name as eventName
from website_event
- where event_type = {eventType:UInt32}
- and website_id = {websiteId:UUID}
- and created_at >= {startAt:DateTime('UTC')}
+ where website_id = {websiteId:UUID}
+ and created_at >= {startAt:DateTime}
+ and event_type = {eventType:UInt32}
`,
{
websiteId,
diff --git a/queries/analytics/pageviews/getPageviewStats.ts b/queries/analytics/pageviews/getPageviewStats.ts
index 7421adf90..cd1125cea 100644
--- a/queries/analytics/pageviews/getPageviewStats.ts
+++ b/queries/analytics/pageviews/getPageviewStats.ts
@@ -60,11 +60,11 @@ async function relationalQuery(
where website_event.website_id = {{websiteId::uuid}}
and website_event.created_at >= {{resetDate}}
and website_event.created_at between {{startDate}} and {{endDate}}
- and event_type = ${EVENT_TYPE.pageView}
+ and event_type = {eventType:UInt32}
${filterQuery}
group by 1
`,
- { ...filters, websiteId, resetDate, startDate, endDate },
+ { ...filters, websiteId, resetDate, startDate, endDate, eventType: EVENT_TYPE.pageView },
);
}
@@ -106,12 +106,12 @@ async function clickhouseQuery(
where website_id = {websiteId:UUID}
and created_at >= {resetDate:DateTime}
and created_at between {startDate:DateTime} and {endDate:DateTime}
- and event_type = ${EVENT_TYPE.pageView}
+ and event_type = {eventType:UInt32}
${filterQuery}
group by t
) as g
order by t
`,
- { ...filters, websiteId, resetDate, startDate, endDate },
+ { ...filters, websiteId, resetDate, startDate, endDate, eventType: EVENT_TYPE.pageView },
);
}
diff --git a/queries/analytics/sessions/getSessionMetrics.ts b/queries/analytics/sessions/getSessionMetrics.ts
index 0cdbd06a1..723b65a9f 100644
--- a/queries/analytics/sessions/getSessionMetrics.ts
+++ b/queries/analytics/sessions/getSessionMetrics.ts
@@ -65,12 +65,12 @@ async function clickhouseQuery(
where website_id = {websiteId:UUID}
and created_at >= {resetDate:DateTime}
and created_at between {startDate:DateTime} and {endDate:DateTime}
- and event_type = ${EVENT_TYPE.pageView}
+ and event_type = {eventType:UInt32}
${filterQuery}
group by x
order by y desc
limit 100
`,
- { ...filters, websiteId, resetDate, startDate, endDate },
+ { ...filters, websiteId, resetDate, startDate, endDate, eventType: EVENT_TYPE.pageView },
);
}
diff --git a/queries/analytics/stats/getWebsiteStats.ts b/queries/analytics/stats/getWebsiteStats.ts
index aeae7b538..845e725e2 100644
--- a/queries/analytics/stats/getWebsiteStats.ts
+++ b/queries/analytics/stats/getWebsiteStats.ts
@@ -43,7 +43,7 @@ async function relationalQuery(
join website
on website_event.website_id = website.website_id
${joinSession}
- where event_type = ${EVENT_TYPE.pageView}
+ where event_type = {{eventType}}
and website.website_id = {{websiteId::uuid}}
and website_event.created_at >= {{resetDate}}
and website_event.created_at between {{startDate}} and {{endDate}}
@@ -51,7 +51,7 @@ async function relationalQuery(
group by 1, 2
) as t
`,
- { ...filters, websiteId, resetDate, startDate, endDate },
+ { ...filters, websiteId, resetDate, startDate, endDate, eventType: EVENT_TYPE.pageView },
);
}
@@ -83,11 +83,11 @@ async function clickhouseQuery(
where website_id = {websiteId:UUID}
and created_at >= {resetDate:DateTime}
and created_at between {startDate:DateTime} and {endDate:DateTime}
- and event_type = ${EVENT_TYPE.pageView}
+ and event_type = {eventType:UInt32}
${filterQuery}
group by session_id, time_series
) as t;
`,
- { ...filters, websiteId, resetDate, startDate, endDate },
+ { ...filters, websiteId, resetDate, startDate, endDate, eventType: EVENT_TYPE.pageView },
);
}