Sub topic 4
The scroll event and the 90% threshold
This chapter covers the scroll event that enhanced measurement collects. It explains what triggers the event, what it does and doesn't tell you, and how to get finer depth data with a custom event.
Prerequisites
This chapter assumes you have:
- A GA4 property with a web data stream and the Google tag installed (gtag.js or Google Tag Manager).
- A working grasp of GA4 events and parameters.
- Access to the data stream settings in Admin.
- Basic HTML and JavaScript for the code examples.
What the scroll event records
When the Page scrolls toggle is on in enhanced measurement, the Google tag listens for scrolling on every page. The first time a visitor reaches roughly 90% of the vertical depth of the page, the tag sends one event named scroll.
Three details matter in practice:
- One event per page view. The tag sends
scrollat most once for each page load. Scrolling back up and down does not send it again. - One threshold only. There is no event at 25%, 50% or 75%. A visitor who scrolls to 80% and leaves sends nothing.
- Vertical only. Horizontal scrolling is not measured.
The event carries the standard parameters sent with every event, such as page_location, page_title and page_referrer. It also carries a parameter that records the depth reached.
| Parameter | Meaning | Typical value |
|---|---|---|
| `percent_scrolled` | Depth at which the event fired | `90` |
| `page_location` | URL of the page | `https://example.com/blog/post` |
| `page_title` | Title of the page | `How to configure GA4` |
Note that percent_scrolled is a parameter of the event, not a dimension in your reports. It becomes available in Explorations and standard reports only after you register it as a custom dimension. The chapter on reporting covers that step.
How the 90% threshold works
The tag compares how far the visitor has scrolled with the total height of the page. When the bottom of the viewport passes about 90% of the page height, the event fires.
The measurement is relative to the page, not to the screen. This has consequences:
- On a short page that fits on one screen, the 90% point may already be visible at load. Depending on how the page is built, the event can fire with little or no scrolling.
- On a very long page, 90% may be far below the content you care about. A visitor can read an entire article, stop at the end of the text, and never reach a footer that makes up the last 10% of the page. No event is sent.
- If the page height changes after load, for example through lazy-loaded content or an infinite feed, the 90% point moves. The result is less predictable on such pages.
Because of this, the event works better as a coarse signal that a visitor reached the bottom area of the page than as a measure of reading.
Turning the event on or off
You control the event in the data stream settings.
- In GA4, open Admin.
- Under Data collection and modifications, open Data streams and select your web stream.
- In Enhanced measurement, confirm that the main switch is on, then open the gear icon.
- Switch Page scrolls on or off, and save.
The change applies to the whole stream. You cannot set a different threshold, and you cannot limit the event to certain pages from these settings.
Turn the toggle off when you plan to send your own scroll event under the name scroll. If both run, the built-in event and your event arrive with the same name. The result is duplicate or mixed data that is hard to separate later.
Reading the data in reports
Once events arrive, you can find them in Reports > Engagement > Events. The scroll row shows the event count and the number of users who triggered it.
Some points help you interpret the numbers:
- Divide the users who triggered
scrollby the total users of the page to get a rough "reached the bottom" rate. You need to build this in an Exploration, filtered by page. - A low rate on a long page may reflect the layout and not the content. Check the page length first.
- On pages where 90% is visible on load, the rate is inflated.
To break the event down by percent_scrolled, register the parameter as an event-scoped custom dimension. Since the built-in event only ever sends 90, the dimension adds little by itself. It becomes useful when you also add your own depth events, as shown below.
Validating the event
Before you trust the data, confirm that the event fires. The tag below enables debug_mode, so your test traffic appears in the DebugView report.
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX', { debug_mode: true });
</script>Open the page, scroll slowly to the bottom, and watch Admin > DebugView. You should see scroll appear once, after you pass the 90% point. Scroll up and down again and check that no second event appears. Remove debug_mode when testing ends, or limit it to your own traffic.
If you use Google Tag Manager, Tag Assistant preview mode shows the same event in the Summary list.
Getting 25%, 50% and 75% with a custom event
If you need more than one depth, add your own event. Use a different name from scroll, so it does not collide with the built-in event. The snippet below sends scroll_depth once for each threshold on each page view.
const thresholds = [25, 50, 75];
const fired = new Set();
window.addEventListener('scroll', () => {
const doc = document.documentElement;
const scrollable = doc.scrollHeight - doc.clientHeight;
if (scrollable <= 0) return;
const percent = (window.scrollY / scrollable) * 100;
thresholds.forEach((t) => {
if (percent >= t && !fired.has(t)) {
fired.add(t);
gtag('event', 'scroll_depth', { percent_scrolled: t });
}
});
}, { passive: true });How it works:
thresholdslists the depths to report. The built-in event still covers 90%.firedremembers which thresholds were sent, so each one fires once.scrollableis the distance the page can scroll. If it is zero or less, the page fits on screen and the code returns early. This avoids a division by zero.passive: truetells the browser the handler never blocks scrolling, which keeps scrolling smooth.
Limits of this code:
- The
firedset resets on each full page load. On a single-page site where the URL changes without a reload, you must clear it yourself when the route changes. - It uses the whole document height. Pages that scroll inside a container element, rather than the window, are not measured.
- The parameter
percent_scrolleduses the same name as in the built-in event. That helps you reuse one custom dimension, but check that your reports filter by event name when you compare them.
Register percent_scrolled as a custom dimension to see the depth values in reports.
Common pitfalls
| Problem | Cause | What to do |
|---|---|---|
| Scroll count is higher than expected on short pages | The 90% point is visible without scrolling | Exclude short pages in your analysis, or use a custom event |
| No scroll events on a long page | The visitor stopped before 90%, or the footer makes up more than 10% of the page | Use custom depths such as 50% and 75% |
| Two `scroll` events per page view | A custom tag also sends `scroll` | Rename your event or turn off the built-in toggle |
| No events on a page with an inner scrolling container | The tag watches the window scroll only | Send a custom event from the container's scroll handler |
| `percent_scrolled` missing in reports | The parameter is not registered as a custom dimension | Register it in **Admin > Custom definitions** |
| Repeated depth events on a single-page site | The fired set is not reset when the route changes | Clear the set on each virtual page view |
Choosing between the built-in and custom approach
Keep the built-in event when you only need a rough signal that visitors reached the lower part of a page. It costs nothing to maintain, and it works the same on every page.
Add a custom event when you need several depths, when pages are very short or very long, or when the content sits in a scrolling container. Do not send a second event named scroll. Pick a distinct name and keep the built-in toggle on unless you have a clear reason to replace it.
Exercise
A blog post is very long, and its last 15% is a footer with links and a newsletter form. A visitor reads the whole article, stops at the end of the text (about 82% of the page), and leaves. Does enhanced measurement send a scroll event? What would you add to capture this visitor's progress, and what name should the event have?
Show answer
No. The built-in event fires only once the visitor passes about 90% of the page height, and this visitor stopped at about 82%. To capture the progress, add a custom event with a thresholds list such as 25, 50 and 75 (and optionally 80), sent with a name like scroll_depth so it does not collide with the built-in scroll event. Register percent_scrolled as a custom dimension to see the values in reports.
Exercise
You test your site in DebugView and see two scroll events on each page view. Name two likely causes and how you would tell them apart.
Show answer
One cause is a custom tag or script that also sends an event named scroll. The other is that the Google tag is installed twice on the page, for example both hard-coded and through Google Tag Manager, so every enhanced measurement event is sent twice. To tell them apart, check whether other enhanced events, such as page_view, are also duplicated. If everything is duplicated, you have a double installation. If only scroll is duplicated, look for a custom scroll event and rename it or turn off the built-in toggle.