mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 23:57:12 +01:00
Add event_type filter for events endpoint
This commit is contained in:
parent
20b8f59b76
commit
373e46ad70
2 changed files with 13 additions and 3 deletions
|
|
@ -465,15 +465,21 @@ export function getEventMetrics(
|
|||
filters = {},
|
||||
) {
|
||||
const params = [website_id, start_at, end_at];
|
||||
const { url } = filters;
|
||||
const { url, event_type } = filters;
|
||||
|
||||
let urlFilter = '';
|
||||
let eventTypeFilter = '';
|
||||
|
||||
if (url) {
|
||||
urlFilter = `and url=$${params.length + 1}`;
|
||||
params.push(decodeURIComponent(url));
|
||||
}
|
||||
|
||||
if (event_type) {
|
||||
eventTypeFilter = `and event_type=$${params.length + 1}`;
|
||||
params.push(event_type);
|
||||
}
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select
|
||||
|
|
@ -484,6 +490,7 @@ export function getEventMetrics(
|
|||
where website_id=$1
|
||||
and created_at between $2 and $3
|
||||
${urlFilter}
|
||||
${eventTypeFilter}
|
||||
group by 1, 2
|
||||
order by 2
|
||||
`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue