Skip to content
  • There are no suggestions because the search field is empty.

SPA Optimizations

What the tracking script does for single page apps, and how to turn it off

 IN THIS ARTICLE YOU WILL:


What SPA Optimizations Do

Single page apps, built with frameworks like React, Vue, Angular or Next.js, change the URL and redraw parts of the page without loading a new page. The Convert tracking script has SPA optimizations built in to handle this, and they're on by default in every Web project.

With SPA optimizations on, the tracking script:

  • Runs your experiences again when the URL changes. When a visitor moves to another route, the script picks up the new URL with the next change to the page and checks your experiences' locations and audiences against it. Elements that variations inserted on the previous route are removed first.
  • Re-applies changes your app overwrites. If your app replaces or re-renders an element that a variation changed, for example while the page hydrates, the script applies the change again.
  • Restores what variations added. If your app removes an element or a style that a variation added, the script puts it back.

Turn SPA Optimizations On or Off

The setting is a checkbox called Disable Single Page App Optimizations.

  1. Open your project and click the Configuration tab.
  2. In the left menu, click More Settings.
  3. Find Disable Single Page App Optimizations:
    • Leave it unchecked to keep SPA optimizations on. This is the default.
    • Check it to turn SPA optimizations off.

The change is saved as soon as you click the checkbox, and the app confirms it with The changes have been successfully saved.

The Disable Single Page App Optimizations checkbox under Configuration > More Settings

Only Web projects have this setting. Full Stack projects don't show it. To change it, you need permission to edit the project.

When to Turn SPA Optimizations Off

Leave SPA optimizations on unless they cause a specific problem on your site, whether or not it's a single page app.

If a variation makes the page slow or unresponsive, or navigation links stop working once a change is applied, try the settings in Advanced SPA Configuration: Tracking Script Optimization Tips first. They space out how often the script re-applies changes, and the optimizations stay on.

If that doesn't solve it, check Disable Single Page App Optimizations. With the box checked, the tracking script no longer:

  • runs your experiences again by itself when the URL changes without a page load;
  • re-applies changes that your app overwrites, or puts back elements and styles that your app removes.

After you change the setting, preview your experiences again on the pages they run on. If you're not sure whether SPA optimizations are behind an issue, contact our support team before you change it.

SPA Mode in the Visual Editor

The Visual Editor has its own setting, Enable SPA Mode. It changes how the editor works with your pages while you build a variation, and it doesn't affect live experiences. See How to Enable SPA Mode in the Convert Visual Editor.