Analytics and Tracking

Single Page Application Tracking

Also called SPA tracking

Measuring screen changes on a site that swaps content in place instead of loading a new page from the server.

Quick facts: Single Page Application Tracking

Category
Analytics and Tracking
Also called
SPA tracking
Level
Advanced
Affects
Pageview counts, funnel steps, conversion firing, engagement metrics
Where to see it
Google Tag Manager (history change trigger), GA4 enhanced measurement, browser preview mode
In this article4
  1. How single page application tracking works
  2. Why single page application tracking matters
  3. Where single page application tracking goes wrong
  4. What to do about it

How single page application tracking works

A traditional website asks the server for a new document every time you click a link, and the analytics tag runs again on each new document. A single page application loads once and then rewrites the screen in the browser, updating the address bar without ever fetching a new page. Frameworks such as React, Vue, Angular and Next.js work this way, and so do many modern booking engines and dashboards.

The tag, having run only once, sees only the first screen. To measure the rest you have to tell it when a screen change has happened. There are two usual routes. Analytics can watch the browser history for address changes and record a view each time one occurs, which is what the enhanced measurement option for page changes does. Or the application itself can announce each route change by writing an entry into the data layer, and a tag manager listens for that announcement.

Why single page application tracking matters

Without it, your reports describe the entry screen and nothing else. Everything a visitor did afterwards — the product they configured, the step they abandoned, the confirmation they reached — is invisible, so engagement looks poor and the funnel appears to have no middle.

Conversions suffer most. If the thank-you screen never registers as a view, a conversion built on that screen never fires, ad platforms stop receiving the signal they optimise against, and campaigns are judged on outcomes the site failed to report. On checkout and enquiry flows this is the difference between a campaign that looks profitable and one that looks dead.

Where single page application tracking goes wrong

Timing is the classic fault. The address changes before the new screen has finished rendering, so the view is recorded with the previous page title, or with a title the framework has not yet updated. Reports then show real traffic filed under the wrong screen name, which is harder to spot than missing data.

Duplication is the next fault. Automatic history watching and a manual announcement from the application can both fire for the same route change, doubling views. The same happens when a framework rewrites the address for a filter or a modal that is not really a new screen at all.

Then there are the invisible steps: a checkout implemented as stages within one address, where nothing changes for the browser to notice. Those need their own events, defined with the developers, because no automatic setting can detect them.

What to do about it

Decide first what counts as a screen worth recording. Filters, sort orders and opened dialogs usually do not; steps a customer moves through usually do. Write that list down before anyone touches the tag manager, because it is a business decision rather than a technical one.

Prefer an explicit announcement from the application over automatic detection: ask the developers to push an event after the new screen has rendered and its title has settled, and use the history change trigger only where you cannot get developer time. Then test the whole journey in preview mode, watching for missing views, duplicated views and wrong titles, and repeat the test on a phone. Getting this right is normally part of a wider Google Tag Manager implementation rather than a standalone change.

Do and do not

Do

  • Agree which screen changes are worth recording
  • Push an event after the screen has rendered
  • Test the full journey on a phone

Do not

  • Run automatic history tracking and manual events together
  • Record a view for every filter or dialog
  • Build conversions on page addresses that never change

Questions people ask about this

How do I know if my site is a single page application?

Click through a few links and watch the browser. If the address changes but the page never visibly reloads and the tab stops showing a loading indicator, you are probably on one. Asking your developer which framework the site uses is quicker: React, Vue, Angular and similar frameworks usually behave this way by default.

Does GA4 track single page applications automatically?

Partly. Enhanced measurement includes an option to record a view when the browser history changes, which covers many route changes without extra work. It does not cover steps that happen without an address change, and it can record a view before the new screen title is ready, so the automatic setting still needs testing.

Why are my conversions missing on a React checkout?

Most likely the confirmation screen never registers as a view, so any conversion built on that screen never fires. Ask the developers to announce the confirmation step explicitly through the data layer, build the conversion on that event rather than on a page address, and verify it with a real test transaction.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.