mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
convert attribution report
This commit is contained in:
parent
e799d89606
commit
9cc717f054
2 changed files with 7 additions and 14 deletions
|
|
@ -277,7 +277,7 @@ SELECT DISTINCT
|
||||||
ed.created_at
|
ed.created_at
|
||||||
FROM umami.event_data ed
|
FROM umami.event_data ed
|
||||||
JOIN (SELECT event_id, string_value as currency
|
JOIN (SELECT event_id, string_value as currency
|
||||||
FROM event_data
|
FROM umami.event_data
|
||||||
WHERE positionCaseInsensitive(data_key, 'currency') > 0) c
|
WHERE positionCaseInsensitive(data_key, 'currency') > 0) c
|
||||||
ON c.event_id = ed.event_id
|
ON c.event_id = ed.event_id
|
||||||
WHERE positionCaseInsensitive(data_key, 'revenue') > 0;
|
WHERE positionCaseInsensitive(data_key, 'revenue') > 0;
|
||||||
|
|
|
||||||
|
|
@ -311,21 +311,14 @@ async function clickhouseQuery(
|
||||||
|
|
||||||
const revenueEventQuery = `WITH events AS (
|
const revenueEventQuery = `WITH events AS (
|
||||||
select
|
select
|
||||||
ed.session_id,
|
session_id,
|
||||||
max(ed.created_at) max_dt,
|
max(created_at) max_dt,
|
||||||
sum(coalesce(toDecimal64(number_value, 2), toDecimal64(string_value, 2))) as value
|
sum(revenue) as value
|
||||||
from event_data ed
|
from website_revenue
|
||||||
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
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and ${column} = {conversionStep:String}
|
and ${column} = {conversionStep:String}
|
||||||
and positionCaseInsensitive(ed.data_key, 'revenue') > 0
|
and currency = {currency:String}
|
||||||
group by 1),`;
|
group by 1),`;
|
||||||
|
|
||||||
function getModelQuery(model: string) {
|
function getModelQuery(model: string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue