Ghost/ghost/tinybird/pipes/analytics_sources.pipe
Hannah Wolfe 7e27b1cb36
Clickthrough filtering for stats page (#21095)
closes
https://linear.app/tryghost/issue/ANAL-58/click-through-filtering-for-content
closes
https://linear.app/tryghost/issue/ANAL-60/click-through-filtering-for-sources
closes
https://linear.app/tryghost/issue/ANAL-61/click-through-filtering-for-locations

- This implements filtering and click-throughs for device, browser,
source, location and pathname.
- It requires significant updates to our tinybird setup, to pass through
all the right data and have them as parameters on the API endpoints
- We update the UI to add query parameters when clicking around and then
pass those through to every chart/request.
- We've added a interface to display the filters and remove them

---------

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2024-09-24 15:26:08 +01:00

27 lines
723 B
Plaintext

NODE analytics_sources_1
DESCRIPTION >
Aggregate by referral and calculate session and hits
SQL >
WITH (SELECT domainWithoutWWW(href) FROM analytics_hits LIMIT 1) AS current_domain
SELECT
site_uuid,
toDate(timestamp) AS date,
device,
browser,
location,
source,
pathname,
maxIf(
member_status,
member_status IN ('paid', 'free', 'undefined')
) AS member_status,
uniqState(session_id) AS visits,
countState() AS hits
FROM analytics_hits
WHERE source != current_domain
GROUP BY date, device, browser, location, source, pathname, site_uuid
TYPE MATERIALIZED
DATASOURCE analytics_sources_mv