Exclude XHR and Fetch requests from monitoring

  • Latest Dynatrace
  • How-to guide
  • Published Mar 23, 2026

By default, the New RUM Experience captures a request event whenever the application sends an XMLHttpRequest (XHR) or Fetch request. If a click user interaction triggers the request, a request user action is also captured. You can exclude both request and user action events by creating XHR exclusion rules. These rules are especially useful when your application sends frequent status-based XHR calls that you don't want to include in your user data.

Configure an XHR exclusion rule

To exclude XHR and Fetch requests from monitoring

  1. Go to Experience Vitals Experience Vitals > Overview.
  2. Select Web to view all web frontends.
  3. Select the frontend you want to configure.
  4. On the Settings tab, select XHR Settings.
  5. Under Exclude XHR requests from monitoring, select Add.
  6. Under XHR exclusion rule, specify a JavaScript regular expression that matches the URLs of the requested resources.
Avoid inefficient regular expressions

Inefficient regular expressions can cause performance issues in your application, including browser freezes lasting several seconds. For better performance, write expressions that match a URL substring rather than the entire URL. This is especially relevant for long URLs.

How XHR exclusion rules are applied

The RUM JavaScript tests the regular expression against the URL using RegExp.prototype.test(). The regular expression does not need to match the full URL, but only a substring of it. Matching is case-insensitive.

In the New RUM Experience, the matched URL is always an absolute URL. In RUM Classic, the URL is whatever was passed to the XHR or Fetch call, which can be either relative or absolute. XHR exclusion rules that you configure in the New RUM Experience also apply in RUM Classic, so if you want a rule to work for both, write a regular expression that matches both the absolute URL and the URL passed to the XHR or Fetch call.

Regex tester sites

When composing your regular expression using a site like Regex101, select ECMAScript (JavaScript) as the flavor and turn on the Case insensitive match flag.

Examples

The following examples show how to specify XHR exclusion rules for common scenarios.

Excluding heartbeat requests from your own application

An application sends heartbeat requests using XMLHttpRequest, and since these are same-origin requests, it uses the relative URL /api/heartbeat. Therefore, RUM Classic matches XHR exclusion rules against /api/heartbeat, while the New RUM Experience matches them against the absolute URL https://example.com/api/heartbeat.

Specifying an XHR exclusion rule with the regular expression /api/heartbeat excludes the heartbeat requests from monitoring in both the New RUM Experience and RUM Classic.

Excluding Google Analytics beacons

An application uses Google Analytics, which sends beacons with the URL https://www.google-analytics.com/g/collect?v=2&tid=G-XXXXXXXX&.... Since these are cross-origin requests and the absolute URL is used for the call, XHR exclusion rules match against the absolute URL in both the New RUM Experience and RUM Classic.

Specifying an XHR exclusion rule with the regular expression google-analytics\.com/g/collect excludes these requests from monitoring in both the New RUM Experience and RUM Classic.

Excluding Google Analytics requests altogether

An application uses Google Analytics, which sends requests to the following URLs:

  • https://www.google-analytics.com/g/collect?v=2&tid=G-XXXXXXXX&...
  • https://region1.google-analytics.com/g/collect?v=2&tid=G-XXXXXXXX&...
  • https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX
  • https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX
  • https://www.google-analytics.com/collect?v=1&tid=UA-XXXXXXXX-1&...

Since these are cross-origin requests and the absolute URL is used for the call, XHR exclusion rules match against the absolute URL in both the New RUM Experience and RUM Classic.

Specifying an XHR exclusion rule with the regular expression google-analytics\.com|googletagmanager\.com excludes these requests from monitoring in both the New RUM Experience and RUM Classic.

Related tags
Digital Experience