Last updated: 23 Apr 2026
frontend: Adding GA4 scroll tracking
If you need to add GA4 scroll tracking to a route, follow these steps:
- Navigate to
app/helpers/application_helper.rb - Add the base path to the
PERCENTAGE_SCROLL_TRACKING_URLSarray - Scroll tracking should now appear on that base path
For example:
PERCENTAGE_SCROLL_TRACKING_URLS = [
"/guidance/assessing-sites-for-local-plans-stage-2",
"/guidance/confirming-draft-allocations-and-recording-decisions-for-local-plans-stage-4",
"/guidance/determining-your-draft-allocations-for-local-plans-stage-3",
].freeze