Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

fix event data, remove field implementation for now

Francis Cao82f9a423131b
diff --git a/queries/analytics/eventData/getEventDataEvents.ts b/queries/analytics/eventData/getEventDataEvents.ts
index 7a926eaf6..c3458c846 100644
--- a/queries/analytics/eventData/getEventDataEvents.ts
+++ b/queries/analytics/eventData/getEventDataEvents.ts
@@ -27,7 +27,7 @@ async function relationalQuery(
) {
const { rawQuery } = prisma;
const website = await loadWebsite(websiteId);
- const { field, event } = filters;
+ const { event } = filters;
if (event) {
return rawQuery(
@@ -35,19 +35,19 @@ async function relationalQuery(
select
we.event_name as event,
ed.event_key as field,
+ ed.data_type as type,
ed.string_value as value,
count(ed.*) as total
from event_data as ed
inner join website_event as we
on we.event_id = ed.website_event_id
- where ed.website_id = {{websiteId:uuid}}
- and ed.event_key = {{field}}
+ where ed.website_id = {{websiteId::uuid}}
and ed.created_at between {{startDate}} and {{endDate}}
and we.event_name = {{event}}
- group by ed.event_key, ed.string_value
- order by 3 desc, 2 desc, 1 asc
+ group by we.event_name, ed.event_key, ed.data_type, ed.string_value
+ order by 1 asc, 2 asc, 3 asc, 4 desc
`,
- { ...filters, websiteId, startDate: maxDate(startDate, website.resetAt), endDate },
+ { websiteId, startDate: maxDate(startDate, website.resetAt), endDate, ...filters },
);
}
return rawQuery(
@@ -55,18 +55,18 @@ async function relationalQuery(
select
we.event_name as event,
ed.event_key as field,
- ed.string_value as value,
+ ed.data_type as type,
count(ed.*) as total
from event_data as ed
inner join website_event as we
on we.event_id = ed.website_event_id
where ed.website_id = {{websiteId::uuid}}
- and ed.event_key = {{field}}
and ed.created_at between {{startDate}} and {{endDate}}
- group by we.event_name, ed.event_key, ed.string_value
- order by 3 desc, 2 desc, 1 asc
+ group by we.event_name, ed.event_key, ed.data_type
+ order by 1 asc, 2 asc
+ limit 100
`,
- { websiteId, field, startDate: maxDate(startDate, website.resetAt), endDate },
+ { websiteId, startDate: maxDate(startDate, website.resetAt), endDate },
);
}