Skip to content
FunnelGuard

Fix guide by FunnelsGuard

GA4 page_view not firing on SPA route changes: how to fix it

TRK-033High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

A single-page app (SPA) loads once and then swaps content with JavaScript. The address bar changes, but the page never fully reloads. Many funnels, quote forms, booking widgets and some checkouts work this way. They are often built with React, Vue, Angular or a page builder with in-page steps.

Where the data disappears in an SPA funnel
  1. Landing pageFull page load, page_view sent
  2. Step 2 /detailsURL changes, no page_view
  3. Step 3 /paymentNot recorded
  4. Thank-you /doneNot recorded

Only the first load sends a page_view. Later steps change the URL but send nothing.

Why it costs you leads or sales

Pageviews GA4 records per 100 visits to a 4-step funnelExample numbers
Pageviews GA4 records per 100 visits to a 4-step funnel (example)Step 1: 100 page_views; Step 2 (off): 0 page_views; Step 3 (off): 0 page_views; Step 4 (off): 0 page_views03877100000Step 1Step 2 (off)Step 3 (off)Step 4 (off)page_views

Example: with history change tracking off, only the first step is counted. Numbers are illustrative.

How to check if your site has it

Check for missing SPA page views
  1. Check the setting

    In GA4 go to Admin > Data streams > your web stream > Enhanced measurement > gear icon > Page views > Advanced settings. See whether Page changes based on browser history events is on.

  2. Open DebugView

    Use Tag Assistant or the GA Debugger extension, then open Admin > DebugView. Walk through your funnel.

  3. Count page_view events

    You should see one page_view per step. If you only see one at the start, history changes are not tracked.

  4. Check Reports

    In Reports > Engagement > Pages and screens, look for your later step paths. If they are missing or show very low views, the problem is likely present.

How to fix it

Fix by platform
  1. Turn off the GA4 toggle if you use GTM triggers

    In GA4 Enhanced measurement, switch off history change events so you do not double count.

  2. Add a History Change trigger

    In GTM, Triggers > New > History Change. Fire on All History Changes.

  3. Create a GA4 Event tag

    New tag > Google Analytics: GA4 Event, your measurement ID, event name page_view. Attach the History Change trigger.

  4. Preview and publish

    Use Preview mode, click through the funnel, and confirm the tag fires once per step before publishing.

Manual page_view on route change (example with a generic router hook)javascript
// Call this after each route change
function trackPageView() {
  gtag('event', 'page_view', {
    page_location: window.location.href,
    page_path: window.location.pathname,
    page_title: document.title
  });
}

// Example: wrap history.pushState if your router has no hook
(function (history) {
  var push = history.pushState;
  history.pushState = function () {
    var result = push.apply(this, arguments);
    setTimeout(trackPageView, 0);
    return result;
  };
})(window.history);
One visit through a 4-step funnel

History change off

  • 1 page_view recorded
  • Funnel shows 100% drop after step 1
  • Later page paths missing in reports

History change tracked

  • 4 page_views recorded, one per step
  • Funnel exploration shows real drop-off
  • Page-based key events can match

How to confirm it's fixed

Confirmation checklist
  • DebugView shows one page_view for every step you click through
  • Each page_view has the correct page_location and page_title
  • No step shows two page_views in a row
  • Back and forward buttons also send a page_view
  • After 24 hours, Pages and screens lists your step paths
  • Funnel exploration shows more than one step

How to prevent it happening again

How the problem builds up
  1. Day 0

    Funnel rebuilt as a single-page app

  2. Day 1

    Only the first page_view is recorded

  3. Week 2

    Reports show a huge drop after step 1 and the wrong campaign is paused

  4. Week 3

    History change tracking enabled and tested

How FunnelGuard handles this

Questions people ask

Why is GA4 only tracking the first page of my single-page app?

A single-page app does not reload between steps, and GA4 sends page_view on load. Unless history change tracking is on, or you send page_view yourself, later steps are never recorded.

How do I turn on page_view for history changes in GA4?

Go to Admin > Data streams > your web stream > Enhanced measurement > gear icon > Page views > Advanced settings, and switch on Page changes based on browser history events. Then test in DebugView.

Why do I see two page_views per step after fixing it?

You are probably using both the Enhanced measurement toggle and a manual or GTM page_view. Keep one method and turn the other off.

Do I need a GTM History Change trigger if the GA4 toggle is on?

No. The toggle already sends page_view on history changes. Use the GTM trigger only if you prefer to control events in GTM, and then switch the toggle off.

How do I test that GA4 tracks SPA route changes?

Open DebugView with Tag Assistant or the GA Debugger extension and click through each step. Every step should show one page_view with the right page_location.

Does this affect normal WordPress or Shopify pages?

Usually not, because those pages reload fully and send a normal page_view. It matters for in-page steps, app-style checkouts, booking widgets and framework-built sites.

Can FunnelGuard tell me if my SPA funnel is missing page_views?

Yes. FunnelGuard runs your journey on a schedule and checks for a page_view at each step. It alerts you with a screenshot and a likely cause if a step sends none.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: page_view per step.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.