Single-Page Application (SPA) setup and configuration
In Single Page Applications (SPAs), users can navigate between different pages without requiring the browser to make complete page requests. For these websites, you want to send a Parse.ly pageview on each virtual navigation event (push and pop events). Parse.ly’s SPA tracker can detect and track these events. We built the SPA tracker after spending some time handling this with Dynamic Tracking methods.
Note
Getting started with a SPA? Please let support@parsely.com know, and we’ll activate the Parse.ly SPA Tracker.
How Parse.ly SPA tracking works
Upon request, Parse.ly support will activate SPA autotracking. This version of the Parse.ly tracker listens for virtual navigation changes in the browser’s history interface. Upon detecting relevant changes, it sends pageview events to Parse.ly’s servers.
Is the Parse.ly SPA tracking compatible with my SPA?
Parse.ly SPA tracking should work with any common framework, but it has been specifically tested and confirmed for the following:
- React.js
- Gatsby.js
- Next.js
I originally integrated my SPA using dynamic tracking, how can I migrate to the new SPA tracking integration?
This is easy, and only takes a few steps and coordination with the Parse.ly team.
- You add a configuration that deactivates SPA autotrack:
var PARSELY = window.PARSELY || {}; PARSELY.spa = PARSELY.spa || {}; PARSELY.spa.autotrack = false;
- Parse.ly activates the SPA tracker feature
- You update your site to remove dynamic tracking (manual calls to
PARSELY.trackPageView()
based on history state changes) AND re-enable SPA autotrack (revert the change from the first step)
Last updated: January 09, 2025