Some parts of your systems might not be available to robots without the right identification, or you might want to avoid collecting analytics from Datadog robots. You can use the below methods to detect Datadog Synthetic Monitoring robots.
You can use the Synthetic Monitoring IP ranges corresponding to each Datadog managed location:
https://ip-ranges./synthetics.json
You can also identify Datadog robots by using some of the default headers attached to the requests generated by API and browser tests:
The following header is attached to all Datadog API tests robots:
sec-datadog: Request sent by a Datadog Synthetic API Test (https://docs.datadoghq.com/synthetics/) - test_id: <SYNTHETIC_TEST_PUBLIC_ID>
A user-agent: Datadog/Synthetics
is also added.
The following header is attached to all Datadog browser tests robots:
Sec-Datadog: Request sent by a Datadog Synthetic Browser Test (https://docs.datadoghq.com/synthetics/) - test_id: <SYNTHETIC_TEST_PUBLIC_ID>
A user-agent
header with a value that varies depending on the type of browser test run (browser, device) is also added.
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.
You can also leverage your API and browser test configuration Advanced options to add specific identifiers to your tests' requests. You can for instance add custom headers, cookies, or request bodies.
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()
}
Additional helpful documentation, links, and articles: