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,
|
eventType: EVENT_TYPE.customEvent,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const table = unit === 'hour' ? 'website_event_stats_hourly' : 'website_event_stats_daily';
|
||||||
|
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
`
|
`
|
||||||
select
|
select
|
||||||
event_name x,
|
event_name x,
|
||||||
${getDateQuery('created_at', unit, timezone)} t,
|
${getDateQuery('created_at', unit, timezone)} t,
|
||||||
count(*) y
|
count(*) y
|
||||||
from website_event
|
from (
|
||||||
where website_id = {websiteId:UUID}
|
select arrayJoin(event_name) as event_name,
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
created_at
|
||||||
and event_type = {eventType:UInt32}
|
from ${table} website_event
|
||||||
|
where website_id = {websiteId:UUID}
|
||||||
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
|
and event_type = {eventType:UInt32}
|
||||||
${filterQuery}
|
${filterQuery}
|
||||||
|
) as g
|
||||||
group by x, t
|
group by x, t
|
||||||
order by t
|
order by t
|
||||||
`,
|
`,
|
||||||
|
@ -100,7 +100,7 @@ async function clickhouseQuery(
|
|||||||
let columnAgg = column;
|
let columnAgg = column;
|
||||||
let excludeDomain = '';
|
let excludeDomain = '';
|
||||||
if (column === 'referrer_domain') {
|
if (column === 'referrer_domain') {
|
||||||
excludeDomain = `and referrer_domain != {websiteDomain:String} and referrer_domain != ''`;
|
excludeDomain = `and t != {websiteDomain:String} and t != ''`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'entry') {
|
if (type === 'entry') {
|
||||||
@ -111,17 +111,19 @@ async function clickhouseQuery(
|
|||||||
columnAgg = `argMaxMerge(${column})`;
|
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(
|
return rawQuery(
|
||||||
`
|
`
|
||||||
select ${column} x, sum(views) y
|
select g.t as x,
|
||||||
from ${table} website_event
|
count(*) as y
|
||||||
where website_id = {websiteId:UUID}
|
from (
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
select arrayJoin(${column}) as t
|
||||||
and event_type = {eventType:UInt32}
|
from ${table} website_event
|
||||||
${excludeDomain}
|
where website_id = {websiteId:UUID}
|
||||||
${filterQuery}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
|
and event_type = {eventType:UInt32}
|
||||||
|
${filterQuery}) as g
|
||||||
group by x
|
group by x
|
||||||
order by y desc
|
order by y desc
|
||||||
limit ${limit}
|
limit ${limit}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user