On this page
What this issue is
A single-page app, built with React, Vue, Angular or a similar framework, loads once and then swaps content and changes the address bar with the browser History API. The browser never does a full page load, so tags that only run on load do not run again.
GA4 sends the page address in the page_location event parameter. On the wire it shows up as dl in the request to google-analytics.com/g/collect. If your setup reads the URL once, at load, every later event carries that first URL. That is a stale page_location.
Why it costs you leads or sales
Stale URLs make your reports describe a different journey from the one visitors took. The damage is usually quiet, which is why it lasts.
- Every event is credited to the landing page, so a pricing or checkout step looks like it never happens.
- Funnel explorations and path reports that filter on page_location miss steps or show the wrong ones.
- Conversions are credited to the wrong page, so you improve the wrong page.
- Audiences and conversion rules built on a URL contain (for example /thank-you) never match.
- Page-based triggers in ad platforms that read the URL can fire on the wrong page or not at all.
Example: with a stale page_location, almost all purchase events are credited to the landing page; after the fix they appear on the checkout step where they happened.
- Landing /page_view sent with the right URL
- Route change to /pricingNo page_view sent, or sent before the URL updates
- Click eventdl still shows /
- generate_leadCredited to / in reports
The route changes without a page load, so the later events keep the first URL.
How to check if your site has it
Open the site and DevTools
Open the Network tab in your browser DevTools and filter by
collect. Tick Preserve log.Load the first page
Note the
dlvalue in the first request. It should match the address bar.Navigate inside the app
Click internal links without reloading the page, then trigger an event such as a button click or form submit.
Compare dl with the address bar
If
dlstill shows the first URL, or the URL from one step earlier, your page_location is stale. Also check that a new page_view fires on each route change.Confirm in GA4
In Admin > DebugView, click an event and read its page_location parameter. In Reports, a page report with very few pages despite a multi-page app is a warning sign.
How to fix it
The goal is the same everywhere: on each route change, wait until the URL has updated, send a page_view with the new location, and make sure other events read the current URL at the moment they fire.
Turn off automatic page_view in the config tag
In your Google tag, set the parameter send_page_view to false only if you add your own page_view trigger. Otherwise you will get duplicates.
Use a History Change trigger
Create a trigger of type History Change. Fire a GA4 Event tag named page_view on it, in addition to the All Pages or Initialization trigger for the first load.
Pass the current URL
In the event tag add the parameter page_location with the built-in variable {{Page URL}}. Enable Page URL, Page Path and History variables in Variables > Configure. Check in Preview that the value changes after each route change.
Avoid double counting
If GA4 enhanced measurement already tracks page changes based on browser history events, turn off Page changes based on browser history events in the web stream settings, or do not add your own page_view.
Hook into your router
Send a page_view from the router's after-navigation hook, not before it. Read window.location.href at that moment.
Send events with the current URL
For events you send yourself, pass page_location explicitly if you cache it anywhere. Never store the URL in a variable at load and reuse it.
Update the page title too
Set document.title before sending page_view so page_title is right.
Check if you really have a SPA
Standard Webflow pages are full page loads, so this issue is rare. It appears with custom code, page transitions libraries or embedded apps that change the URL without a reload.
Add a route-change event
If you use a transitions library, send a page_view from its after-transition callback in Project Settings > Custom code, or use a GTM History Change trigger.
Identify the cause
Classic themes use full page loads. The issue appears with headless or React-based themes, or page-transition plugins that load pages with AJAX.
Add a History Change trigger
Use GTM as in the Google Tag Manager tab, or send page_view from the theme's navigation callback.
Check your analytics plugin
If a plugin inserts the GA4 tag, check its settings for a SPA or AJAX navigation option. Do not run the plugin and GTM together for the same measurement ID.
// Call this from your router's after-navigation hook
function trackRouteChange() {
gtag('event', 'page_view', {
page_location: window.location.href,
page_title: document.title,
page_referrer: window.__lastUrl || document.referrer
});
window.__lastUrl = window.location.href;
}
// Example with React Router
// const location = useLocation();
// useEffect(() => { trackRouteChange(); }, [location.pathname, location.search]);Stale page_location
- One page_view at load, none on route changes
- dl stays on the landing URL for the whole visit
- Conversions credited to the landing page
Current page_location
- A page_view after each route change
- dl matches the address bar on every event
- Conversions credited to the page where they happened
How to confirm it's fixed
Repeat the Network check
Navigate through three or four routes and trigger a click and a form event. Every
collectrequest should have adlthat matches the address bar at that moment.Use GTM Preview or DebugView
Confirm one page_view per navigation, with the new page_location and page_title.
Check reports the next day
In Reports > Engagement > Pages and screens, you should see the real pages of your app, not just the landing page.
How to prevent it happening again
- Keep one owner for page_view logic: either GA4 enhanced measurement, GTM, or your own code.
- Add a route-change analytics check to your release checklist whenever the router, framework or transitions library is upgraded.
- Never cache window.location in a variable at load for use in later events.
- After each release, click through a few routes with DebugView open.
- Document the setup so a new developer does not add a second page_view.
How FunnelGuard handles this
FunnelGuard does not check for stale page_location yet. It reads the dl parameter in the tracking hits it captures, but it has no rule that compares it with the page the robot was on. A check like this is a possible future addition.
What FunnelGuard does today is run your real journeys on a schedule, from the EU or the US, and confirm that the tracking hits for GA4, Google Ads, Meta and other platforms are sent at each step. It also checks that test leads reach your inbox and CRM. If a tag stops firing after a release, you get one alert with a screenshot and a likely cause after a re-check from a second region.
Questions people ask
Why is my GA4 page_location always the homepage in a single-page app?
Your page_view probably fires only on the first load. A single-page app changes the URL without reloading, so later events reuse the first URL. Send a page_view on every route change, after the address bar has updated.
What is the dl parameter in GA4?
dl is the short name for page_location in the request sent to google-analytics.com/g/collect. It holds the full URL of the page when the event fired. You can read it in the Network tab of your browser DevTools.
How do I track page views in a SPA with Google Tag Manager?
Create a History Change trigger and attach a GA4 Event tag named page_view to it. Add page_location with the {{Page URL}} variable. Make sure GA4 enhanced measurement history tracking is off, or you will count each page twice.
Does GA4 enhanced measurement track SPA page changes automatically?
It can. The Page changes based on browser history events option sends page_view when the History API changes the URL. It does not always work with every router or transition setup, so verify with DebugView.
Why do I see duplicate page_view events after fixing my SPA tracking?
Two things are sending page_view: usually enhanced measurement and your own tag or code. Keep one. Turn off the history-based option in the web stream, or remove your custom page_view.
How do I check that GA4 is sending the right page_location?
Open DevTools, go to Network, filter by collect and click through your routes. The dl value should match the address bar for each request. You can also read page_location on events in GA4 DebugView.
Does FunnelGuard detect stale page_location in GA4?
No, not yet. It checks that tracking hits are sent during your journeys, but it has no rule for comparing page_location with the current page. Check manually with DebugView or the Network tab after each release.
Related issues
- TRK-049Required event parameter missing (form_id, method)Fix guide
- TRK-050Parameter value is undefined, null or '(not set)'Fix guide
- TRK-046Conversion event fires on every page view of thank-you page (refresh)Fix guide
- TRK-044generate_lead fires on page load instead of submitFix guide
- TRK-043generate_lead not sent on form submitFix guide
- TRK-045Lead event fires on submit click even when validation failsFix guide