Persist umami sql queries and stuff

This commit is contained in:
2025-11-18 15:24:07 +01:00
parent 444f7a376e
commit 87dd246d09
12 changed files with 262 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
WITH users AS (
SELECT
w.created_at,
s.distinct_id,
substring(s.distinct_id SIMILAR '%#"@%#"' ESCAPE '#') AS group
FROM
website_event AS w
JOIN
session AS s
ON s.session_id = w.session_id
WHERE
w.website_id = '16e7d807-4db5-45fd-92a9-27393445a153'
AND w.event_type = 1
AND w.created_at BETWEEN '2025-10-13' AND '2025-10-19'
AND s.distinct_id IS NOT NULL
)
SELECT
COUNT(DISTINCT users.distinct_id)
FROM
users
WHERE
users.group NOT IN ('@oceanbox.io')
;