mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 12:05:41 +01:00
Init support funnel by hosts
This commit is contained in:
parent
38ab685143
commit
ae9cf908f8
2 changed files with 24 additions and 13 deletions
|
|
@ -20,6 +20,7 @@ export function FunnelStepAddForm({
|
||||||
const items = [
|
const items = [
|
||||||
{ label: formatMessage(labels.url), value: 'url' },
|
{ label: formatMessage(labels.url), value: 'url' },
|
||||||
{ label: formatMessage(labels.event), value: 'event' },
|
{ label: formatMessage(labels.event), value: 'event' },
|
||||||
|
{ label: formatMessage(labels.hosts), value: 'hosts' },
|
||||||
];
|
];
|
||||||
const isDisabled = !type || !value;
|
const isDisabled = !type || !value;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,18 @@ async function relationalQuery(
|
||||||
(pv, cv, i) => {
|
(pv, cv, i) => {
|
||||||
const levelNumber = i + 1;
|
const levelNumber = i + 1;
|
||||||
const startSum = i > 0 ? 'union ' : '';
|
const startSum = i > 0 ? 'union ' : '';
|
||||||
const isURL = cv.type === 'url';
|
let column;
|
||||||
const column = isURL ? 'url_path' : 'event_name';
|
switch (cv.type) {
|
||||||
|
case 'url':
|
||||||
|
column = 'url_path';
|
||||||
|
break;
|
||||||
|
case 'event':
|
||||||
|
column = 'event_name';
|
||||||
|
break;
|
||||||
|
case 'hosts':
|
||||||
|
column = 'hostname';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
let operator = '=';
|
let operator = '=';
|
||||||
let paramValue = cv.value;
|
let paramValue = cv.value;
|
||||||
|
|
@ -84,26 +94,26 @@ async function relationalQuery(
|
||||||
if (levelNumber === 1) {
|
if (levelNumber === 1) {
|
||||||
pv.levelOneQuery = `
|
pv.levelOneQuery = `
|
||||||
WITH level1 AS (
|
WITH level1 AS (
|
||||||
select distinct session_id, created_at
|
select distinct we.website_id, we.session_id, we.created_at, we.url_path, we.event_name, s.hostname
|
||||||
from website_event
|
from website_event we
|
||||||
where website_id = {{websiteId::uuid}}
|
join session s
|
||||||
and created_at between {{startDate}} and {{endDate}}
|
on we.session_id = s.session_id
|
||||||
|
where we.website_id = {{websiteId::uuid}}
|
||||||
|
and we.created_at between {{startDate}} and {{endDate}}
|
||||||
and ${column} ${operator} {{${i}}}
|
and ${column} ${operator} {{${i}}}
|
||||||
)`;
|
)`;
|
||||||
} else {
|
} else {
|
||||||
pv.levelQuery += `
|
pv.levelQuery += `
|
||||||
, level${levelNumber} AS (
|
, level${levelNumber} AS (
|
||||||
select distinct we.session_id, we.created_at
|
select distinct l.website_id, l.session_id, l.created_at, l.url_path, l.event_name, l.hostname
|
||||||
from level${i} l
|
from level${i} l
|
||||||
join website_event we
|
where l.website_id = {{websiteId::uuid}}
|
||||||
on l.session_id = we.session_id
|
and l.created_at between l.created_at and ${getAddIntervalQuery(
|
||||||
where we.website_id = {{websiteId::uuid}}
|
|
||||||
and we.created_at between l.created_at and ${getAddIntervalQuery(
|
|
||||||
`l.created_at `,
|
`l.created_at `,
|
||||||
`${windowMinutes} minute`,
|
`${windowMinutes} minute`,
|
||||||
)}
|
)}
|
||||||
and we.${column} ${operator} {{${i}}}
|
and l.${column} ${operator} {{${i}}}
|
||||||
and we.created_at <= {{endDate}}
|
and l.created_at <= {{endDate}}
|
||||||
)`;
|
)`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue