A storefront can return a 200 status code while customers cannot find a product or open the checkout. Synthetic tests find this kind of failure before customers report it, because they run your key journeys on a fixed schedule. This guide shows how to build a tiered synthetic test suite for an e-commerce storefront in Datadog: which journeys to test, which test type to use, how often and from where to run each test, and which failures should page someone. It is written for tech leads and platform engineers who own a storefront. Our post on frontend SLOs and rollback runbooks shows how synthetic tests feed SLOs and runbooks. This post goes deeper into the tests themselves. The Terraform example uses the DataDog/datadog provider 4.32.0, the current version on 1 December 2026.
Sort the journeys into tiers
Not every journey needs the same test. Sort the journeys by how directly a failure stops a sale.
- Tier 1: a failure stops revenue directly. Examples are the home page, product discovery, search, the cart and the start of the checkout.
- Tier 2: a failure hurts the experience, but customers can still buy. Examples are login, the mobile home page and the store locator.
- Tier 3: trends that you review, not failures that wake someone up. Examples are page performance and API health.
The table below is a starting point, taken from a client design that we describe at the end of this post.
| Tier | Journey | What the test checks | Frequency |
|---|---|---|---|
| 1 | Home page | The page loads within 3 seconds, the main navigation is present and the search box works | Every 2 minutes |
| 1 | Product discovery | Home page, category page, first product. The product page shows a price and an add-to-cart button | Every 5 minutes |
| 1 | Add to cart | The cart counter updates and the product is in the cart | Every 10 minutes |
| 1 | Search | A stable search term returns at least 5 products | Every 10 minutes |
| 1 | Checkout entry | The test goes from the cart to the checkout page and checks the form fields. It stops before payment | Every 15 minutes |
| 2 | Login | A test account can log in | Every 20 minutes |
| 2 | Mobile home page | The mobile menu and the search overlay work, and the page has no horizontal scroll | Every 20 minutes |
| 2 | Store locator | A fixed location returns at least 3 stores and the map renders | Every 30 minutes |
| 3 | Page performance | LCP under 2.5 seconds and CLS under 0.1 | Every 15 minutes |
| 3 | API health | A response under 500 milliseconds with valid JSON | Every 5 minutes |
The frequency follows the cost of a missed failure. The home page test runs most often, because it is a short test and most customers start there. The longer browser tests run less often, because each run takes more time and sends more requests to your platform.
Pick the right test type
Datadog Synthetic Monitoring has several test types. Use the simplest type that proves the journey works.
| Test type | Use it for | What it does |
|---|---|---|
| HTTP API test | Home page availability, API health | Sends one request and asserts on the status code, response time, headers and body |
| Multistep API test | Search and cart APIs | Chains HTTP requests and passes values, such as a cart ID, from one response to the next request |
| Browser test | Product discovery, add to cart, checkout entry, login | Runs a recorded journey in Chrome, Firefox or Edge, on a laptop, tablet or mobile screen size |
| Private location | Internal APIs, environments that are not public | Runs your tests from a container inside your own network |
An HTTP test only checks the response. It does not run your JavaScript, so use a browser test for any journey where the page must render and react to clicks. A mobile screen size in Chrome is not Safari on an iPhone, so use RUM data to find problems on real devices.
A private location runs as a Docker container, a Helm chart on Kubernetes or a Windows service, and pulls its test configuration from Datadog over HTTPS. It also lets you compare results from inside and outside your network.
HTTP, multistep and browser tests can link a test run to the backend traces in APM. For browser tests, first add the URLs of your app to the allowed list in the settings.
Keep each test short
A long end-to-end journey looks attractive, because one test from the home page to the order confirmation covers everything. In practice, it fails for many reasons, and the alert does not tell you which part broke. Short tests are more resilient, and each failure points to one journey.
- Test one journey per test. The cart test starts on a product page, adds the product and checks the cart. It does not test search too.
- Reuse steps with subtests. Record common steps once, such as opening the home page and closing the cookie banner. Then add them as a subtest to other browser tests. Datadog supports up to two levels of nesting. You can pause a subtest, so that it only runs inside its parent tests.
- Use stable locators. Datadog lets you set a user locator with a CSS selector or XPath. Point it at a stable attribute, such as a
data-testid, and not at a generated class name. - Assert on structure, not on content. Check that a price is present, not that it has a specific amount. Check that search returns at least 5 products, not which products. Prices, stock and merchandising change every day.
- Stop before payment. The checkout test opens the checkout page and checks the form fields. It does not place an order, so it creates no orders, payments or confirmation emails.
- End with a useful assertion. In Datadog, a browser test must end with an assertion. Make that last check the one that proves the journey works.
Use dedicated test products and accounts
A test that depends on real catalogue data fails when a product sells out or a campaign ends. Create test data that exists only for your tests.
- Test products. Create dedicated test products that stay in the catalogue in every market and language. Keep one or two popular, stable products as a fallback.
- Search terms. Use stable terms. Avoid seasonal or promotional terms, because they disappear after a campaign.
- Test accounts. Create a dedicated account with minimal privileges, and one account per market if your markets use separate accounts. Never use real customer data.
- Secrets. Store passwords as global variables in Datadog and obfuscate them, so that the values do not show in test results. Rotate them on a schedule, for example every quarter.
Then keep the test traffic out of your business data. Datadog API tests send the user agent Datadog/Synthetics, and the user agent of browser tests ends with DatadogSynthetics. Datadog also documents the header x-datadog-origin: synthetics and publishes the IP ranges of its managed locations. In browser tests, Datadog sets a window variable that you can check before you start your analytics:
if (!window._DATADOG_SYNTHETICS_BROWSER) {
initAnalytics(); // your own analytics setup
}
Set locations and retries
Run each test from more than one location, because a single location can fail for reasons outside your platform. Scale the number of locations with the tier: run tier 1 tests from 3 locations, tier 2 tests from 2 and tier 3 tests from 1. Pick managed locations close to your customers.
Datadog alerts when any assertion fails for X minutes from any n of N locations. With 3 locations, set n to 2 for the alert that pages someone. Send a failure in one location to the team channel as a warning, because it can point to a problem near that location and not in your storefront.
Add fast retries to every test. A fast retry runs the test again after a short wait, 300 milliseconds by default, before the run counts as failed. In Terraform, API tests allow up to 3 retries and browser tests up to 2. The minimum duration timer starts after the last fast retry fails. For a rule such as “two failed runs in a row” on a test that runs every 10 minutes, set the minimum duration to about 10 minutes, so that one failed run alone does not alert.
If a CDN serves your storefront, set the HTTP version of your HTTP tests to HTTP/2 only or HTTP/1.1 only. Datadog advises this for endpoints behind a CDN, because the default fallback can cause intermittent errors. During planned maintenance, schedule a downtime so that the tests do not page anyone.
Decide what pages someone
A page must mean that customers cannot buy right now. Everything else goes to a channel or a digest. Use three levels:
| Level | Example triggers | Where it goes | Response |
|---|---|---|---|
| Critical | The home page fails once, the cart or search fails twice in a row | Page the on-call engineer and post in the incident channel | Within 5 minutes |
| Warning | Response time more than 20% slower over 3 checks in 15 minutes, a failure in one location, API response time up by more than 50% | Team channel and email, after a 15-minute delay | Within 30 minutes |
| Info | A small variation under 20%, tier 3 failures, other non-critical issues | Daily digest, reviewed at the stand-up | Next stand-up |
In Datadog, give each test monitor a priority from P1 to P5. In Terraform, this is monitor_priority. Then use the message to route the alert. With a conditional template, the failed step decides who gets the notification:
{{#is_alert}}
{{#is_match "synthetics.failed_step.description" "Checkout"}}@<checkout-team-handle>
{{else}}@<storefront-team-handle>
{{/is_match}}
{{/is_alert}}
{{#is_recovery}}@<storefront-team-handle>{{/is_recovery}}
Always add a handle in the {{else}} branch and in the recovery message. Datadog drops a notification when no handle is present. Before you go live, use Simulate Notifications to send a test notification and check the routing. For P1 tests, set a renotify interval, so that a test that stays in alert is notified again.
Define a tier 1 test in Terraform
The home page test below is an HTTP API test. It runs every 2 minutes from the tier 1 locations and pages when 2 locations fail.
resource "datadog_synthetics_test" "home_page" {
name = "[Tier 1] Home page availability"
type = "api"
subtype = "http"
status = "live"
locations = var.tier1_locations
tags = ["team:<team-handle>", "tier:1", "journey:home"]
message = <<-EOT
{{#is_alert}}The home page fails from 2 or more locations. Runbook: <runbook-link> @<paging-handle>{{/is_alert}}
{{#is_recovery}}The home page works again. @<paging-handle>{{/is_recovery}}
EOT
request_definition {
method = "GET"
url = "https://<storefront-domain>/"
}
assertion {
type = "statusCode"
operator = "is"
target = "200"
}
assertion {
type = "responseTime"
operator = "lessThan"
target = "3000"
}
assertion {
type = "body"
operator = "contains"
target = "<stable-marker-in-the-page>"
}
options_list {
tick_every = 120
min_location_failed = 2
min_failure_duration = 0
http_version = "http2"
monitor_priority = 1
retry {
count = 2
interval = 300
}
monitor_options {
renotify_interval = 30
}
}
}
tick_every is in seconds. API tests accept 30 seconds to one week, and browser tests accept 60 seconds to one week. A browser test in Terraform also needs device_ids and a browser_step block for each step. You can record the journey in the Datadog recorder and then copy each step with “Copy Terraform step snippet”.
Roll it out in four weeks
Add tests and alerts in steps, and tune each step before you add the next one.
| Week | Work |
|---|---|
| 1 | Set up the tool and the test data. Build the tier 1 tests and the critical alerts. |
| 2 | Add the login and mobile tests and the warning alerts. Review and tune. |
| 3 | Add the store locator test. Review reliability, fix slow or flaky tests and write runbooks for the 5 most common failures. |
| 4 | Tune thresholds, add tests based on recent incidents, train the teams and hand over. |
Set targets for the rollout: a false-positive rate under 10% after week 2 and under 5% after week 4, and a mean time to detect under 5 minutes. Track false positives from week 1, because teams stop trusting pages that are often wrong.
After the rollout, review the suite on a schedule:
- Weekly: false positives, response times, test data and test accounts.
- Monthly: trends, coverage, thresholds and credential rotation.
- Quarterly: tool cost, coverage, new features and a retrospective.
In practice
In January 2026, we designed a tiered synthetic test suite for an international cosmetics retailer that was moving its storefront from Salesforce Commerce Cloud to headless Next.js, one market at a time. The tiers, checks, frequencies, alert levels, test data rules and four-week rollout in this post come from that design. Tier 1 tests were to run from 3 locations, tier 2 tests from 2 and tier 3 tests from 1. When we wrote the design, the home page, product discovery, add-to-cart, checkout entry and login tests were in place, and the search, store locator and mobile home page tests were still to be built. The rollout plan set targets, not results: a false-positive rate under 10% after week 2 and under 5% after week 4, and a mean time to detect under 5 minutes. Read the full case study.
Checklist
- Sort the journeys into tiers by how directly a failure stops a sale.
- Use the simplest test type that proves a journey works.
- Keep each test to one journey and stop before payment.
- Assert on structure, not on prices or product names.
- Use dedicated test products, stable search terms and test accounts.
- Store credentials as obfuscated global variables and rotate them.
- Keep synthetic traffic out of your analytics.
- Run tier 1 tests from 3 locations and page when 2 fail.
- Add a handle and an
{{else}}branch to every conditional message. - Review false positives every week.
For a review of your synthetic tests and alerts, see the frontend observability assessment.
Sources
- Datadog: API testing
- Datadog: HTTP testing
- Datadog: Browser testing
- Datadog: Browser testing steps
- Datadog: Multistep API testing
- Datadog: Synthetic Monitoring notifications
- Datadog: Synthetic Monitoring conditional alerting
- Datadog: How synthetic monitors trigger alerts
- Datadog: Private locations
- Datadog: Identify synthetic bots
- Datadog: Synthetic Monitoring settings
- Datadog: Synthetic APM
- Terraform provider: datadog_synthetics_test