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.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
convert attribution report
Francis Cao9cc717f0546f
diff --git a/db/clickhouse/schema.sql b/db/clickhouse/schema.sqlindex ff85112ba..396d300aa 100644--- a/db/clickhouse/schema.sql+++ b/db/clickhouse/schema.sql@@ -277,7 +277,7 @@ SELECT DISTINCTed.created_atFROM umami.event_data edJOIN (SELECT event_id, string_value as currency- FROM event_data+ FROM umami.event_dataWHERE positionCaseInsensitive(data_key, 'currency') > 0) cON c.event_id = ed.event_idWHERE positionCaseInsensitive(data_key, 'revenue') > 0;diff --git a/src/queries/sql/reports/getAttribution.ts b/src/queries/sql/reports/getAttribution.tsindex 0c3d447a3..f224eb5ce 100644--- a/src/queries/sql/reports/getAttribution.ts+++ b/src/queries/sql/reports/getAttribution.ts@@ -311,21 +311,14 @@ async function clickhouseQuery(const revenueEventQuery = `WITH events AS (select- ed.session_id,- max(ed.created_at) max_dt,- sum(coalesce(toDecimal64(number_value, 2), toDecimal64(string_value, 2))) as value- from event_data ed- join (select event_id- from event_data- where website_id = {websiteId:UUID}- and created_at between {startDate:DateTime64} and {endDate:DateTime64}- and positionCaseInsensitive(data_key, 'currency') > 0- and string_value = {currency:String}) c- on c.event_id = ed.event_id+ session_id,+ max(created_at) max_dt,+ sum(revenue) as value+ from website_revenuewhere website_id = {websiteId:UUID}and created_at between {startDate:DateTime64} and {endDate:DateTime64}- and ${column} = {conversionStep:String}- and positionCaseInsensitive(ed.data_key, 'revenue') > 0+ and ${column} = {conversionStep:String}+ and currency = {currency:String}group by 1),`;function getModelQuery(model: string) {