Update umami sql queries

This commit is contained in:
2026-05-26 16:51:46 +02:00
parent f0eb28a627
commit cda142b3d1
4 changed files with 24 additions and 9 deletions
+12 -7
View File
@@ -9,9 +9,11 @@ WITH base AS (
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'
-- NOTE: This is only available in grafana
-- AND $__timeFilter(w.created_at)
AND w.created_at BETWEEN current_timestamp - '7 days'::interval and current_timestamp
AND s.distinct_id IS NOT NULL
-- AND substring(s.distinct_id SIMILAR '%#"@%#"' ESCAPE '#') IN ('@leroyseafood.com')
-- AND substring(s.distinct_id SIMILAR '%#"@%#"' ESCAPE '#') IN ($groups)
),
unique_totals AS (
SELECT
@@ -28,9 +30,12 @@ unique_users AS (
GROUP BY "Group"
)
SELECT
SUM("Users in range")
FROM
unique_totals
t."Group",
t."Users in range" AS "Weekly users"
FROM unique_totals t
LEFT JOIN
unique_users u USING ("Group")
WHERE
LOWER("Group") NOT IN ('@oceanbox.io')
;
t."Group" <> '@oceanbox.io'
ORDER BY
"Users in range" DESC;