Skip to main content
SPA Tracking: Public Beta

Find out more about how single page application (SPA) tracking works with the our products.

Helena Hrubesova avatar
Written by Helena Hrubesova
Updated over 6 months ago

What is an SPA?

“A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current web page with new data from the web server, instead of the default method of a web browser loading entire new pages.” - Wikipedia

In simpler terms, an SPA is a type of application or a “website” that does not need a page to be reloaded in order to show new content. SPAs are capable of dynamically changing the content, so they don’t need to reload the pages.

What is SPA tracking?

Currently, the Leadfeeder tracking script does not track the changes of page URL. It only considers a pageview to be new when the page is reloaded.

Since SPAs don’t necessarily reload pages, this leads to lack of insights for our users. The Leadfeeder app would show only a single pageview in these cases, instead of all the pages the user actually viewed during their visit.

To improve this behaviour, we have added a new “tracking mode” to the Leadfeeder Tracker: the “SPA tracking mode".

Which SPAs are eligible for the SPA tracking mode?

  • Many SPAs change the page URL while updating the content without reloading the page. The Leadfeeder tracking script now supports the tracking of pageviews for these SPAs.

  • Some SPAs don't change the page URL while updating the content. These SPAs are not eligible for our SPA tracking. If this is your case, please ask our support to disable the SPA auto-tracking for your tracker and use the on_script_load tracking.

Essentially, our SPA tracking mode only records changes in the page URL, without a reload. If the page URL doesn’t change when a specific action is performed, it won’t be tracked.

How does the SPA tracking mode work?

When SPA tracking is enabled, the Leadfeeder Tracker will start identifying changes in the page URLs, even if the page is not reloaded.

For tracking changes in the same page URL, these changes need to be at least 1 second apart. We do this so we don’t generate unnecessary pageviews in cases of rage clicks or repetitive clicks by visitors.

As an example, if a button that changes the page URL is clicked multiple times, the changes in pageviews will be recorded only for clicks that were at least 1 second apart.

  • 3 clicks in <1 second would record 1 pageview.

  • 2 clicks in <1 second and 1 click after 1 second would record 2 pageviews.

The Leadfeeder Tracker currently identifies two types of changes in the page URL:

Changes in URL path

  • For example, while on example.com/product if a button is clicked, the URL changes to example.com/contact without reloading the page

  • example.org/home changes to example.org/new?date=today and then changes to example.org/contact?param without reloading the page

Changes in the URL hash fragment (part of the URL after #)

  • For example, while on example.com/product if a button is clicked, the URL changes to example.com/product#contact

  • While on example.com/product#info if a button is clicked, the URL changes to example.com/product#contact

  • In this example, the hash fragments are #info and #contact

What does SPA tracking imply for users?

When SPA tracking is enabled, each change in the URL will create a new pageview. If the page URLs change very frequently, the pageviews in a visit are expected to go up.

If the customer is using manual tracking via Google Tag Manager (GTM) or JavaScript API to create pageview events, the Leadfeeder Tracker will start to ignore those once the company’s script is switched to “SPA Tracking”. This is done to prevent duplication of pageviews.

We’ll only ignore events that we already recorded, that is, changes in the page URL. Other specific events sent through manual tracking will continue to work.

What are the current limitations?

The Leadfeeder app currently does not show the hash fragment in a pageview. This means that if the hash fragment changes, we would identify a new pageview, but since we don’t show hash fragments, the app would display another pageview with the same base URL. (i.e., duplicate pageviews).

How do I enable SPA tracking on my account?

SPA tracking mode is enabled by default in the Leadfeeder Tracker for all accounts that signed up after May 2022. If you signed up before and need this feature, please reach out to support and we’ll be happy to help!

--

Questions, comments, feedback? Please let us know by contacting our support team via the chat or by sending us an email at support@dealfront.com.

RELATED:

Did this answer your question?