08bf49eaec
ref https://linear.app/tryghost/issue/ANAL-27/setup-tinybird-project-and-cicd ref https://github.com/tinybirdco/web-analytics-starter-kit/blob/main/tinybird/pipes/analytics_sessions.pipe - These datasources and pipes work together to define the main endpoints we need for our stats dashboard - They are based on the web analytics starter kit from tinybird - We've updated them to handle site_uuid - There's more to do to pipe the member-related and post-related data through the system yet
22 lines
590 B
Plaintext
22 lines
590 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,
|
|
referrer,
|
|
uniqState(session_id) AS visits,
|
|
countState() AS hits
|
|
FROM analytics_hits
|
|
WHERE domainWithoutWWW(referrer) != current_domain
|
|
GROUP BY date, device, browser, location, referrer, site_uuid
|
|
|
|
TYPE MATERIALIZED
|
|
DATASOURCE analytics_sources_mv
|