Landing pages
Marketing teams judge pages by how many visits start on them. That number differs from page views, so it needs its own query.
How it works
Start from page_view events and find the entrance event of each session. Read its page location, then count distinct sessions for each landing page.
- Read
entrancesandpage_locationfromevent_paramsby their keys and typed value fields. - Filter to
entrances = 1before you group. Otherwise later page views count as landing pages. - Count distinct session identities for each page location.
Common mistake
Grouping every page_view event by URL counts page views. One session can add several pages that way, and most of them are not landing pages.
Worked example
WITH page_views AS (
SELECT 's1' AS session_id, '/start' AS page, 1 AS entrances UNION ALL
SELECT 's1', '/later', 0 UNION ALL
SELECT 's2', '/pricing', 1 UNION ALL
SELECT 's3', '/start', 1
), entrance_pages AS (
SELECT session_id, page FROM page_views WHERE entrances = 1
)
SELECT page, COUNT(DISTINCT session_id) AS sessions
FROM entrance_pages
GROUP BY page
ORDER BY sessions DESC, pageThe raw data has both the entrance and a later page view for session s1.
Filtering on entrances first leaves out /later. /start has two landing sessions and /pricing has one.