Page Path Analysis
This SQL template aggregates Google Analytics data to provide a monthly overview of page paths, including metrics such as screen page views, total users, new users, event count, conversions, total revenue, and user engagement duration, grouped by traffic source.
- Grain
- month x property x page path
- Built from
- 1Raw tables
- 1Core
- 1Analytics
- Reads from Google Analytics 4
- page_path
- Ships as
- Weld and dbt SQL, open source on GitHub
1-- core.google_analytics_4.page_path_analysis
2-- Page Path Analysis. This SQL template aggregates Google Analytics data to provide
3-- a monthly overview of page paths, including metrics such as screen page views,
4-- total users, new users, event count, conversions, total revenue, and user
5-- engagement duration.
6--
7-- Grain: month x property x page path. The page path report has no channel
8-- dimension, so it cannot be split by traffic source; joining the channel
9-- report on date would repeat every page once per channel and multiply the
10-- sums. Pages by channel need a report that carries both dimensions, such as
11-- a custom report with page path and session default channel group.
12-- total_users is a sum of daily users, not unique users.
13--
14-- From the weld.app template library, corrected. Not reconciled against Google
15-- Analytics 4; check the output against the source before relying on it.
16
17SELECT
18 DATE_TRUNC(date, MONTH) AS period, -- change to DAY for a daily overview
19 property_id,
20 page_path,
21 SUM(screen_page_views) AS screen_page_views,
22 SUM(total_users) AS total_users,
23 SUM(new_users) AS new_users,
24 SUM(event_count) AS event_count,
25 SUM(conversions) AS conversions,
26 SUM(total_revenue) AS total_revenue,
27 SUM(user_engagement_duration) AS user_engagement_duration
28FROM
29 {{raw.google_analytics_4.page_path}}
30GROUP BY
31 period,
32 property_id,
33 page_path
34ORDER BY
35 screen_page_views DESCThis model and the 1 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().
How it counts. And where it stops.
The Page Path Analysis SQL model is designed to provide comprehensive insights into user interactions on your website by leveraging Google Analytics data. This model aggregates key metrics such as screen page views, total users, new users, event count, conversions, total revenue, and user engagement duration, grouped by page path and traffic source. By summarizing these metrics on a monthly basis (with an option to switch to daily), businesses can identify the most visited pages, understand user behavior, and evaluate the effectiveness of different traffic sources. This analysis is particularly useful for optimizing website content, improving user engagement, and driving conversions.
Raw tables it reads
- raw.google_analytics_4.page_path
More Google Analytics 4 models
Put Google Analytics 4 in front
of your agents.
Connect Google Analytics 4, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.