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

Advanced SPA Configuration: Tracking Script Optimization Tips

Troubleshooting SPA Edge Cases with Convert Tracking Script: Performance Tips for Seamless Experiment Execution

 THIS ARTICLE WILL HELP YOU:


 Purpose of This Guide

This document provides advanced configuration tips for handling edge cases in Single Page Applications (SPAs) when using the Convert tracking script. These solutions are only needed if you encounter specific performance issues with SPAs. The tracking script works seamlessly in most scenarios without these adjustments.


 Common SPA Issues and Solutions

  1. SPA Mutating Navigation Links on Click

    • Issue: When navigation links are modified by a variation and subsequently trigger DOM mutations upon clicking, the navigation may appear broken or unresponsive.
    • Solution: Try a higher throttleChanges value, so the tracking script reacts to page changes less often while the navigation updates.
      _conv_q.push({
        what: 'setParameters',
        params: {
          throttleChanges: 100 // milliseconds
        }
      });
  2. SPA Constantly Mutating the DOM

    • Issue: In cases where the SPA produces constant, unnecessary DOM mutations, the tracking script may react too frequently. This could degrade performance, clutter the page, or even cause the page to freeze.
    • Solution: Use throttleChanges to limit how often the tracking script reacts to changes on the page, so it does not make excessive updates.
      _conv_q.push({
        what: 'setParameters',
        params: {
          throttleChanges: 100 // milliseconds
        }
      });

How throttleChanges works: it is the minimum time, in milliseconds, between two reactions of the tracking script to changes on your page. The default is 50. A higher value means the script reacts less often. Page changes that happen within that time are handled at the next page change after it, so a very high value can hold back your changes until the page changes again. Raise the value in steps and test after each change.

 When to Use These Configurations

These solutions are meant for troubleshooting SPA-specific performance issues such as:

  • Broken navigation links.
  • Poor page performance, clutter, or freezing due to excessive DOM mutations.

Avoid applying these configurations unless you are encountering these specific problems. The Convert tracking script is optimized for SPAs and generally does not require additional setup.

 Implementation Location

If needed, add the configurations to the Global JavaScript section of your Convert Project Configuration. Ensure they are tested thoroughly in a staging environment before deploying to production.