Skip to end of metadata
Go to start of metadata

On this page:

Related pages:

Your Rating:
1 Star2 Star3 Star4 Star5 Star
42 rates

For SPA2, you only need to set a flag to enable the JavaScript Agent to auto-instrument SPAs. When SPA2 auto-instrumentation is enabled, the JavaScript Agent will do the following:

  • detect virtual pages

  • measure the end-to-end time for virtual pages

  • correlate resources, JavaScript errors, and Ajax requests

  • name virtual pages

SPA2 Requirements

Enable/Disable SPA2 Monitoring

In the JavaScript Agent configuration, set spa2 to true and then inject the JavaScript Agent as shown below. You can use either manual or automatic injection. The default value for spa2 is false, so to enable SPA2 monitoring, you must set the spa2 to true

<script charset='UTF-8'>
    window['adrum-start-time'] = new Date().getTime();
        config.appKey = '<EUM_APP_KEY>';
        config.adrumExtUrlHttp = '';
        config.adrumExtUrlHttps = '';
        config.beaconUrlHttp = ' ';
        config.beaconUrlHttps = '';
        config.xd = {enable : false}; = {
            "spa2": true 
    })(window['adrum-config'] || (window['adrum-config'] = {}));
    if ('https:' === document.location.protocol) {
            + " src='' "
            + " type='text/javascript' charset='UTF-8'"
            + unescape('%3E%3C/script%3E'));
    } else {
           + " src='' "
           + " type='text/javascript' charset='UTF-8'"
           + unescape('%3E%3C/script%3E'));

You must set the configuration, including the setting to enable SPA2 monitoring, before you load the JavaScript Agent.

Disable SPA2 Monitoring

To disable SPA2 auto-instrumentation, just set spa2 to false. Although the default value for spa2 is false, you are recommended to set the configuration to false and not remove it.

Migrate from SPA1 to SPA2 Monitoring

To migration from SPA1 to SPA2 monitoring:

  1. Read Which SPA Monitoring to Use? to confirm that your use case is suitable for SPA2.
  2. Meet the SPA2 requirements.
  3. Enable SPA2 monitoring.

How the End User Response Time Is Calculated

The following page describes how the End User Response Time (EURT) is measured for virtual pages. Browser Monitoring calculates the EURT differently for base pages, Ajax requests, and virtual pages. While Browser RUM provides different metrics for base pages and Ajax requests, virtual pages only have the EURT metric.

The diagram below shows the browser and JavaScript Agent activity in parallel to demonstrate how the JavaScript Agent defines the start and end points for the EURT as well as correlates Ajax requests, resources, and JavaScript errors.


StepBrowser ActivityJavaScript Agent Actions

The user navigates to the base page of a SPA. The HTML skeleton, core CSS, and JavaScript are loaded into the browser. 

The JavaScript Agent sends a beacon for the base page.

From the base page, the user clicks a button to view products. The URL changes as the virtual page is loaded through a combination of previously downloaded content and from new content fetched through Ajax requests.

The JavaScript marks the user action as the start time of the virtual page.

User actions and the browser activity cease for five seconds. The browser activity includes requesting resources, making Ajax calls, etc.

The JavaScript Agent marks the end of the virtual page and sends a beacon for it; however, if the virtual-page load stalls on one slow activity, the JavaScript Agent waits eight seconds before marking the end of the virtual page.

Any activities such as Ajax requests, resource loads, and JavaScript errors that happened during the virtual page load will be correlated to that virtual page.

There are some kinds of browser activities that aren't accessible to JavaScript. For example, the time that the browser takes render the DOM to the screen after the DOM has been updated. Therefore, if your virtual pages don’t request any resources, you will likely see a very fast EURT (<10ms).

SPA2 Monitoring Compatability

When you configure the JavaScript Agent to use SPA2 auto-instrumentation, the following happens:

  • You cannot use the JavaScript API to manually report events.

  • Metrics other than EURT, such as DOM ready, # of digests, etc., are no longer measured and reported for virtual pages.

  • No labels