mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-11 22:13:20 +03:00
e3268c8c59
closes https://linear.app/tryghost/issue/ANAL-111/rename-hits-to-pageviews-inside-of-tinybird - We currently have two concepts: visits (unique visits) and pageviews (also called hits) - We want to standardise on this terminology, so inside tinybird, we're going to call hit "pageviews" to make it super clear what's happening
28 lines
837 B
Plaintext
28 lines
837 B
Plaintext
NODE analytics_sessions_1
|
|
DESCRIPTION >
|
|
Aggregate by session_id and calculate session metrics
|
|
|
|
SQL >
|
|
SELECT
|
|
site_uuid,
|
|
toDate(timestamp) AS date,
|
|
session_id,
|
|
maxIf(
|
|
member_status,
|
|
member_status IN ('paid', 'free', 'undefined')
|
|
) AS member_status,
|
|
anySimpleState(post_uuid) AS post_uuid,
|
|
anySimpleState(device) AS device,
|
|
anySimpleState(browser) AS browser,
|
|
anySimpleState(location) AS location,
|
|
anySimpleState(source) AS source,
|
|
anySimpleState(pathname) AS pathname,
|
|
minSimpleState(timestamp) AS first_view,
|
|
maxSimpleState(timestamp) AS latest_view,
|
|
countState() AS pageviews
|
|
FROM analytics_hits
|
|
GROUP BY date, session_id, site_uuid
|
|
|
|
TYPE MATERIALIZED
|
|
DATASOURCE analytics_sessions_mv
|