mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
update event/pageview metrics
This commit is contained in:
parent
f518066d93
commit
3a4cefef72
2 changed files with 21 additions and 13 deletions
|
|
@ -51,17 +51,23 @@ async function clickhouseQuery(
|
|||
eventType: EVENT_TYPE.customEvent,
|
||||
});
|
||||
|
||||
const table = unit === 'hour' ? 'website_event_stats_hourly' : 'website_event_stats_daily';
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select
|
||||
event_name x,
|
||||
${getDateQuery('created_at', unit, timezone)} t,
|
||||
count(*) y
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
from (
|
||||
select arrayJoin(event_name) as event_name,
|
||||
created_at
|
||||
from ${table} website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
${filterQuery}
|
||||
) as g
|
||||
group by x, t
|
||||
order by t
|
||||
`,
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ async function clickhouseQuery(
|
|||
let columnAgg = column;
|
||||
let excludeDomain = '';
|
||||
if (column === 'referrer_domain') {
|
||||
excludeDomain = `and referrer_domain != {websiteDomain:String} and referrer_domain != ''`;
|
||||
excludeDomain = `and t != {websiteDomain:String} and t != ''`;
|
||||
}
|
||||
|
||||
if (type === 'entry') {
|
||||
|
|
@ -111,17 +111,19 @@ async function clickhouseQuery(
|
|||
columnAgg = `argMaxMerge(${column})`;
|
||||
}
|
||||
|
||||
const table = unit === 'hour' ? 'website_event_metric_hourly' : 'website_event_metric_daily';
|
||||
const table = unit === 'hour' ? 'website_event_stats_hourly' : 'website_event_stats_daily';
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select ${column} x, sum(views) y
|
||||
from ${table} website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
${excludeDomain}
|
||||
${filterQuery}
|
||||
select g.t as x,
|
||||
count(*) as y
|
||||
from (
|
||||
select arrayJoin(${column}) as t
|
||||
from ${table} website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
${filterQuery}) as g
|
||||
group by x
|
||||
order by y desc
|
||||
limit ${limit}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue