GA4 in BigQuery · Engagement and events
Scroll depth by page in GA4 BigQuery
GA4 enhanced measurement sends one scroll event per page the first time 90% of its height becomes visible. Count scroll and page_view events per page_location to get the share of page views that reached the bottom. Other depths need your own tracking.
The query
WITH events AS (
SELECT
event_name,
REGEXP_REPLACE(
(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_location'),
r'[?#].*$', '') AS page
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201231'
AND event_name IN ('page_view', 'scroll')
)
SELECT
page,
COUNTIF(event_name = 'page_view') AS views,
COUNTIF(event_name = 'scroll') AS scrolls_to_90,
ROUND(SAFE_DIVIDE(COUNTIF(event_name = 'scroll'), COUNTIF(event_name = 'page_view')), 3) AS scroll_rate
FROM events
GROUP BY page
HAVING views >= 100
ORDER BY views DESC
LIMIT 20;How it works
With enhanced measurement on, GA4 fires scroll the first time a user reaches the bottom of each page, which Google defines as 90% of the vertical depth becoming visible. There is one threshold and at most one event per page view, so scroll depth from the default setup is a yes or no: did this view reach 90%?
The query counts page views and scroll events per page and divides them. The result is the share of views that reached the bottom. In the sample, the scroll event carries an integer percent_scrolled parameter (493,072 events, the same count as scroll events); the second variation shows its values.
For 25, 50 and 75 percent you need your own tracking, for example a Google Tag Manager scroll depth trigger that sends a custom event or parameter. Those then appear in the export like any other event and can be counted the same way.
| Column | Meaning |
|---|---|
views | page_view events for the page. |
scrolls_to_90 | scroll events on the page: views that reached 90% depth. |
scroll_rate | Scroll events divided by page views. |
Notes and cost
- Cost: reads
event_nameand thestring_valuepart ofevent_paramsfor one month, 484.5 MiB. Filtering to two event names does not reduce bytes. - If a page view fires
scrolland the URL changed in between (single-page apps), the scroll lands on a differentpage_locationthan the view. Check pages with a rate above 1.
Variations
Values of percent_scrolled
SELECT
(SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'percent_scrolled') AS percent_scrolled,
COUNT(*) AS events
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX = '20201201'
AND event_name = 'scroll'
GROUP BY percent_scrolled
ORDER BY events DESC;Share of sessions with any scroll to 90%
WITH sessions AS (
SELECT
LOGICAL_OR(event_name = 'scroll') AS scrolled
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20201231'
GROUP BY user_pseudo_id, (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id')
)
SELECT
COUNT(*) AS sessions,
ROUND(COUNTIF(scrolled) / COUNT(*), 3) AS share_with_scroll
FROM sessions;FAQ
How does GA4 track scroll depth?
Enhanced measurement sends a scroll event the first time a user reaches 90% of the page height on each page. It does not track other depths.
How do I track 25%, 50% and 75% scroll in GA4?
Add your own scroll tracking, for example a Google Tag Manager scroll depth trigger that sends an event with the percentage. It then appears in the export as its own event or parameter.
Related
All GA4 export queries · BigQuery cost queries · The GA4 sample dataset
