mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
update event/pageview metrics
This commit is contained in:
parent
f518066d93
commit
3a4cefef72
@ -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
|
||||
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
|
||||
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}
|
||||
${excludeDomain}
|
||||
${filterQuery}
|
||||
${filterQuery}) as g
|
||||
group by x
|
||||
order by y desc
|
||||
limit ${limit}
|
||||
|
Loading…
x
Reference in New Issue
Block a user