mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
move queries
This commit is contained in:
parent
910f165103
commit
8aec6d7406
53 changed files with 920 additions and 485 deletions
28
queries/analytics/event/getEventMetrics.js
Normal file
28
queries/analytics/event/getEventMetrics.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { getDateQuery, getFilterQuery, rawQuery } from 'queries';
|
||||
|
||||
export function getEventMetrics(
|
||||
website_id,
|
||||
start_at,
|
||||
end_at,
|
||||
timezone = 'utc',
|
||||
unit = 'day',
|
||||
filters = {},
|
||||
) {
|
||||
const params = [website_id, start_at, end_at];
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select
|
||||
event_value x,
|
||||
${getDateQuery('created_at', unit, timezone)} t,
|
||||
count(*) y
|
||||
from event
|
||||
where website_id=$1
|
||||
and created_at between $2 and $3
|
||||
${getFilterQuery('event', filters, params)}
|
||||
group by 1, 2
|
||||
order by 2
|
||||
`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue