Monitor single page applications

Enable out-of-the-box metrics for single-page applications.

Overview

Previously, the Splunk RUM browser agent only captured page load times for the initial document load or refresh. When the URL changed without a full page reload—common in single-page applications (SPAs)—the agent emitted spans with zero duration for these route changes (also called virtual pages). This limited visibility into SPA performance.

With the enhancements in version 2.2.0, the Splunk RUM browser agent now:

  • Automatically detects route changes in SPAs and captures route change load times (if enabled in your Splunk RUM browser agent configuration).
  • Consistently surfaces route change durations across features, including Tag Spotlight, dashboards, alerts, MMS metrics, and the new Pages List View.
  • Emits a new Page Complete Time (PCT) metric that measures the load time of a route change based on defined heuristics.

Enabling PCT metric collection ensures every route-change span has a non-zero duration representing how long the page took to load.

Configuration

To enable this feature, update your Splunk RUM browser agent configuration as follows:

Option 1: Enable with defaults
JAVASCRIPT
import SplunkRum from '@splunk/otel-web'

SplunkRum.init({
  realm: 'your-splunk-realm',
  rumAccessToken: 'your-splunk-rum-token',
  applicationName: 'your-application-name',
  spaMetrics: true,
})
Option 2: Enable with custom configuration
For parameter descriptions, see spaMetrics settings.
JAVASCRIPT
import SplunkRum from '@splunk/otel-web'

SplunkRum.init({
  realm: 'your-splunk-realm',
  rumAccessToken: 'your-splunk-rum-token',
  applicationName: 'your-application-name',
  spaMetrics: {
    quietTime: 3000,            
    maxResourcesToWatch: 50, 
    ignoreUrls: [/analytics/], 
  },
})

How Splunk RUM calculates PCT

Splunk RUM calculates page completion time for single-page applications by watching page-loading activity after a route change. The quiet timer starts when the page or route starts. If RUM detects monitored activity, such as matching network requests, media loading, or resource-timing entries, it keeps the page open until that activity completes. After the last monitored activity ends, RUM waits for the configured quiet period before completing the page measurement. In version 3.1.0 and later, the default quiet period is 1 second. In version 3.0.x, the default was 5 seconds. The shorter default helps prevent unrelated background activity from extending page-load measurements.
Note: By default, pending activity from a previous page or route is cleared when a new navigation starts. This helps avoid carrying background work from one route into the next page completion measurement.
Example:
JSON
SplunkRum.init({
  spaMetrics: {
    quietTime: 1000,
    maxResourcesToWatch: 50,
    ignoreUrls: [
      /analytics/i,
      'regex/\\/polling\\/status/i',
    ],
    clearLoadingResourcesOnNewPage: true,
  },
});

Troubleshooting

  • Ensure you're using Splunk RUM browser agent version 2.2.0 or later.
  • Confirm that spaMetrics is enabled in your Splunk RUM browser agent configuration.
  • Monitor for any network or media resources that may stall loading, as this can delay PCT calculation.