Overview

Some parts of your systems may not be available to robots without the appropriate identification. You may also want to avoid collecting analytics from Datadog robots.

Try a combination of the following methods to detect Datadog’s Synthetic Monitoring robots.

IP addresses

Use the Synthetic Monitoring IP ranges corresponding to each Datadog managed location:

https://ip-ranges./synthetics.json

The listed IPs use the Classless Inter-Domain Routing (CIDR) notation and may require conversion to IPv4 address ranges before use. Except in the case of new managed locations IPs, the listed IPs rarely change.

If you want to be alerted when the listed IPs change, create an API test on the endpoint above with a JSONPath assertion such as $.synthetics['prefixes_ipv4_by_location']['aws:ap-northeast-1'].length.

Default headers

Identify Datadog robots by using default headers, which are attached to the requests generated by Synthetic tests.

user-agent

By default, a user-agent header is added to all requests performed by Synthetic tests. Any custom user-agent added in the test overrides the default one.

For single and multistep API tests, the default user-agent header is Datadog/Synthetics.

For browser tests, the value of the default user-agent header varies depending on the browser and device executing the test. The default user-agent value always ends with DatadogSynthetics to allow you to identify Synthetic tests.

sec-datadog

A sec-datadog header is added to all requests performed by Synthetic tests. The value includes the test ID which the request originates from.

sec-datadog: Request sent by a Datadog Synthetics API Test (https://docs.datadoghq.com/synthetics/) - test_id: <SYNTHETIC_TEST_PUBLIC_ID>
sec-datadog: Request sent by a Datadog Synthetics Browser Test (https://docs.datadoghq.com/synthetics/) - test_id: <SYNTHETIC_TEST_PUBLIC_ID>

APM headers

A number of other APM specific headers such as x-datadog-origin: synthetics is also added to requests generated by Synthetic API and browser tests.

Customize requests

You can leverage your API and browser test configuration in Advanced options and add specific identifiers to your tests’ requests such as custom headers, cookies, and request bodies.

Browser variables

When a Datadog robot is rendering your application, the window._DATADOG_SYNTHETICS_BROWSER variable is set to true. To remove the robot actions from your analytics data, wrap your analytics tool code with the following test:

if (window._DATADOG_SYNTHETICS_BROWSER === undefined) {
  initializeAnalytics()
}

If you use the browser variable to identify Synthetic bots on Firefox, Datadog cannot guarantee that the browser variable is set before your code executes.

Cookies

Cookies that are applied in your browser include datadog-synthetics-public-id and datadog-synthetics-result-id.

These cookies are available for all steps in Firefox. For Microsoft Edge and Google Chrome, these cookies are set only for the start URL.

Further Reading

PREVIEWING: antoine.dussault/service-representation-ga-docs-us1