---
title: Browser testing template variables
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Synthetic Testing and Monitoring > Synthetic Monitoring Notifications >
  Synthetic Monitoring Template Variables > Browser testing template variables
---

# Browser testing template variables

## Overview{% #overview %}

Template variables allow you to insert dynamic values from your browser test results and configuration into notification messages. These variables are accessed using the `synthetics.attributes` prefix.

{% alert level="info" %}
Use the filter above to view variables by category.
{% /alert %}

{% section displayed-if="Variables is Test results" %}
This section only applies to users who meet the following criteria: Variables is Test results

This section covers two categories of variables:

- Test execution variables: Shortcuts for commonly used values such as failure messages, step counts, duration, and tags.
- Execution results: The full result object with status, timestamps, failure codes, and step counts.

### Test execution variables{% #test-execution-variables %}

Path: `synthetics` (various shortcuts)

Use these variables to access common test execution data such as failure messages, step counts, duration, and tags.

{% dl %}

{% dt %}
`{{synthetics.failed_step.failure.message}}`
{% /dt %}

{% dd %}
The error message (for example, `Element's content should match the given regex`).
{% /dd %}

{% dt %}
`{{synthetics.failed_step.url}}`
{% /dt %}

{% dd %}
The URL of the failed step (for example, `https://www.datadoghq.com/blog/`).
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.response.statusCode}}`
{% /dt %}

{% dd %}
The HTTP status code (for example, `403`).
{% /dd %}

{% dd %}
**Note:** Review the [conditional alerting](https://docs.datadoghq.com/synthetics/notifications/conditional_alerting/) page for an example of how to use this variable in a notification.
{% /dd %}

{% dt %}
`{{synthetics.result.step_count}}`
{% /dt %}

{% dd %}
Number of steps (for example, `4`).
{% /dd %}

{% dt %}
`{{synthetics.result.duration}}`
{% /dt %}

{% dd %}
Duration of the test run (in milliseconds) (for example, `9096`).
{% /dd %}

{% dt %}
`{{tags}}`
{% /dt %}

{% dd %}
Lists all the tags added to the synthetics test.
{% /dd %}

{% dd %}
To access individual tag values, use `{{tags.<tag-key>}}`. For example, if your test is tagged with `env:prod`, use `{{tags.env}}` to return the tag value `prod`.
{% /dd %}

{% /dl %}

### Execution results{% #execution-results %}

Path: `synthetics.attributes`

Use these variables to access test execution results, status, duration, and step counts.

{% tab title="Result" %}

{% dl %}

{% dt %}
`{{synthetics.attributes.result}}`
{% /dt %}

{% dd %}
The `result` object contains information about the executed test run
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.id}}`
{% /dt %}

{% dd %}
Unique result ID
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.status}}`
{% /dt %}

{% dd %}
Test execution status (for example, `passed` or `failed`)
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.duration}}`
{% /dt %}

{% dd %}
Test duration in milliseconds
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.testStartedAt}}`, `{{synthetics.attributes.result.testFinishedAt}}`, `{{synthetics.attributes.result.testTriggeredAt}}`
{% /dt %}

{% dd %}
Epoch timestamps in milliseconds
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.failure}}`
{% /dt %}

{% dd %}
The `failure` object contains information about why the test failed
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.failure.message}}`
{% /dt %}

{% dd %}
The failure message
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.failure.code}}`
{% /dt %}

{% dd %}
The failure code
{% /dd %}

{% /dl %}

For a complete list of API test error codes, see [API Testing Errors](https://docs.datadoghq.com/synthetics/api_tests/errors/). Review the [conditional alerting](https://docs.datadoghq.com/synthetics/notifications/conditional_alerting#send-alerts-based-on-an-error-code) page for an example of how to use the `synthetics.attributes.result.failure` variable in a notification.
{% /tab %}

{% tab title="Count" %}

{% dl %}

{% dt %}
`{{synthetics.attributes.count}}`
{% /dt %}

{% dd %}
The `count` object contains step statistics about the test
{% /dd %}

{% dt %}
`{{synthetics.attributes.count.steps.total}}`
{% /dt %}

{% dd %}
The total number of steps
{% /dd %}

{% dt %}
`{{synthetics.attributes.count.steps.completed}}`
{% /dt %}

{% dd %}
The number of steps that were run
{% /dd %}

{% dt %}
`{{synthetics.attributes.count.errors}}`
{% /dt %}

{% dd %}
The total number of errors that occurred while running the test. For multistep and mobile tests, this is the number of failed steps. For browser tests, this is the sum of all browser errors.
{% /dd %}

{% dt %}
`{{synthetics.attributes.count.hops}}`
{% /dt %}

{% dd %}
The number of traceroute hops for TCP and ICMP tests
{% /dd %}

{% /dl %}

{% /tab %}
{% /section %}

{% section displayed-if="Variables is Test info" %}
This section only applies to users who meet the following criteria: Variables is Test info

### Test metadata{% #test-metadata %}

Path: `synthetics.attributes`

Use these variables to access test configuration and execution location information.

{% tab title="Test Info" %}

{% dl %}

{% dt %}
`{{synthetics.attributes.test}}`
{% /dt %}

{% dd %}
The `test` object contains information about the test like its `name`, `type`, `subtype`, and `id`
{% /dd %}

{% dt %}
`{{synthetics.attributes.test.name}}`
{% /dt %}

{% dd %}
The name of the test
{% /dd %}

{% dt %}
`{{synthetics.attributes.test.type}}`
{% /dt %}

{% dd %}
Test type (for example, `api`)
{% /dd %}

{% dt %}
`{{synthetics.attributes.test.subType}}`
{% /dt %}

{% dd %}
Subtype for API tests (for example, `http`, `dns`, and `multi`)
{% /dd %}

{% dt %}
`{{synthetics.attributes.test.id}}`
{% /dt %}

{% dd %}
The test's public ID (for example, `abc-def-ghi`)
{% /dd %}

{% /dl %}

{% /tab %}

{% tab title="Location" %}

{% dl %}

{% dt %}
`{{synthetics.attributes.location}}`
{% /dt %}

{% dd %}
The `location` object contains information about the location of where the test is run from
{% /dd %}

{% dt %}
`{{synthetics.attributes.location.id}}`
{% /dt %}

{% dd %}
Location ID (for example, `aws:eu-central-1`)
{% /dd %}

{% dt %}
`{{synthetics.attributes.location.name}}`
{% /dt %}

{% dd %}
Name of the location (for example, `Frankfurt (AWS)`)
{% /dd %}

{% dt %}
`{{synthetics.attributes.location.privateLocation}}`
{% /dt %}

{% dd %}
`true` for Private Locations
{% /dd %}

{% /dl %}

{% /tab %}

{% tab title="Device" %}
Path: `synthetics.attributes.device`

{% dl %}

{% dt %}
`{{synthetics.attributes.device}}`
{% /dt %}

{% dd %}
The `device` object contains information about the device on which the test is run on
{% /dd %}

{% dt %}
`{{synthetics.attributes.device.id}}`
{% /dt %}

{% dd %}
Device identifier
{% /dd %}

{% dt %}
`{{synthetics.attributes.device.name}}`
{% /dt %}

{% dd %}
Human-readable device name
{% /dd %}

{% dt %}
`{{synthetics.attributes.device.type}}`
{% /dt %}

{% dd %}
Device type classification
{% /dd %}

{% dt %}
`{{synthetics.attributes.device.width}}`, `{{synthetics.attributes.device.height}}`
{% /dt %}

{% dd %}
Screen resolution dimensions
{% /dd %}

{% /dl %}

**Browser-specific:**

{% dl %}

{% dt %}
`{{synthetics.attributes.device.browser.type}}`
{% /dt %}

{% dd %}
Browser type (for example, `chrome`)
{% /dd %}

{% /dl %}

{% /tab %}
{% /section %}

{% section displayed-if="Variables is Step details" %}
This section only applies to users who meet the following criteria: Variables is Step details

This section covers step-level variables organized by category:

- Failed step information: Shortcuts for the step that caused a test failure.
- Step execution details: Metadata and results for each step, including extracted variable values.

### Failed step information{% #failed-step-information %}

Path: `synthetics.failed_step`

Use these variables to access information about the step that caused a test failure.

{% dl %}

{% dt %}
`{{synthetics.failed_step}}`
{% /dt %}

{% dd %}
The `failed_step` object provides a shortcut to the step that caused the test to fail, eliminating the need to reference `{{synthetics.attributes.result.steps.<step-index>}}` directly.
{% /dd %}

{% dt %}
`{{synthetics.failed_step.description}}`
{% /dt %}

{% dd %}
Shortcut for `{{synthetics.attributes.result.steps.<step-index>.description}}`
{% /dd %}

{% /dl %}

Review the [conditional alerting](https://docs.datadoghq.com/synthetics/notifications/conditional_alerting/#send-alerts-to-a-specific-slack-channel-based-on-failed-step-using-a-variable-shortcut) page for an example of how to use the `synthetics.failed_step.description` shortcut variable in a browser test notification.

### Step execution details{% #step-execution-details %}

Path: `synthetics.attributes.variables.extracted`

These are step execution metadata and results containing detailed information about how each step ran, including response data, timing metrics, and protocol-specific details. These values are only available when the step completes successfully.

{% tab title="General steps" %}

{% dl %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.allowFailure`
{% /dt %}

{% dd %}
Whether the step is allowed to fail without failing the entire test
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.duration`
{% /dt %}

{% dd %}
Step execution duration in milliseconds
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.failure`
{% /dt %}

{% dd %}
Failure information object containing `.code` and `.message`
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.id`
{% /dt %}

{% dd %}
Unique step identifier
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.isCritical`
{% /dt %}

{% dd %}
Whether the step is critical to the test
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.status`
{% /dt %}

{% dd %}
Step execution status
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.type`
{% /dt %}

{% dd %}
Type of step being executed
{% /dd %}

{% /dl %}

**Browser-specific:**

{% dl %}

{% dt %}
`{{synthetics.attributes.result.startUrl}}`
{% /dt %}

{% dd %}
URL from test configuration
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.apiTest.request`
{% /dt %}

{% dd %}
API test request configuration (only for "Run API Test" steps where `type` is `runApiTest`)
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.apiTest.result`
{% /dt %}

{% dd %}
API test result data (similar to `attributes.result` for API tests)
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.assertionResult.expected`
{% /dt %}

{% dd %}
Expected value for assertions
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.assertionResults.checkType`
{% /dt %}

{% dd %}
Type of assertion check
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.assertionResults.actual`
{% /dt %}

{% dd %}
Actual value found during assertion
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.browserErrors`
{% /dt %}

{% dd %}
List of browser errors encountered
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.timings.firstByte`
{% /dt %}

{% dd %}
Time to first byte
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.timings.tcp`
{% /dt %}

{% dd %}
TCP connection timing
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.description`
{% /dt %}

{% dd %}
Step description
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.warnings`
{% /dt %}

{% dd %}
List of warnings, each containing `.message` (the warning message) and `.type` (the warning type: `invalid_config`, `user_locator`, or `unable_to_compute_tti`)
{% /dd %}

{% /dl %}

{% /tab %}

{% tab title="Extracted values" %}
Path: `synthetics.attributes.result.steps.<step-index>.extractedValue`

These are the actual variable values that a step captured during test execution. For example, if you have a browser test step that extracts text from a page element into a variable, this is where you access that extracted value.

For information on how to access the `<step-index>`, see the step summary section.

{% dl %}

{% dt %}
`synthetics.attributes.result.steps.<step-index>.extractedValue.name`
{% /dt %}

{% dd %}
Variable name
{% /dd %}

{% dt %}
`synthetics.attributes.result.steps.<step-index>.extractedValue.secure`
{% /dt %}

{% dd %}
Whether the variable value is obfuscated
{% /dd %}

{% dt %}
`synthetics.attributes.result.steps.<step-index>.extractedValue.value`
{% /dt %}

{% dd %}
Variable value (if step was successful)
{% /dd %}

{% /dl %}

{% /tab %}

{% tab title="Sub-tests" %}

{% dl %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.subTest.id`
{% /dt %}

{% dd %}
Subtest identifier
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.subStep.parentStep.id`
{% /dt %}

{% dd %}
Parent step identifier
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.subStep.parentTest.id`
{% /dt %}

{% dd %}
Parent test identifier
{% /dd %}

{% dt %}
`synthetics.attributes.variables.extracted.steps.subStep.level`
{% /dt %}

{% dd %}
Nesting level (1 for subtests, 2 for subtests of subtests)
{% /dd %}

{% /dl %}

{% /tab %}
{% /section %}

{% section displayed-if="Variables is Local & Global" %}
This section only applies to users who meet the following criteria: Variables is Local & Global

### Local & Global Variables{% #local--global-variables %}

Use these variables to access locally configured variables and globally defined variables in your notifications.

{% tab title="Local" %}
Path: `synthetics.attributes.result.variables.config`

These are local variables configured for API tests or defined outside individual steps in step-based tests. This also includes variables created by JavaScript code execution.

{% dl %}

{% dt %}
`{{synthetics.attributes.result.variables.config.name}}`
{% /dt %}

{% dd %}
Variable name
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.variables.config.type}}`
{% /dt %}

{% dd %}
Variable type
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.variables.config.secure}}`
{% /dt %}

{% dd %}
Whether the variable value is obfuscated
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.variables.config.value}}`
{% /dt %}

{% dd %}
Variable value (non-obfuscated only)
{% /dd %}

{% /dl %}

{% /tab %}

{% tab title="Global" %}
Path: `synthetics.attributes.result.variables.extracted`

These are extracted variables whose value updates a global variable value.

Available only for **successful test results** and **recovery notifications**.

{% dl %}

{% dt %}
`{{synthetics.attributes.result.variables.extracted.id}}`
{% /dt %}

{% dd %}
Global variable ID
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.variables.extracted.name}}`
{% /dt %}

{% dd %}
Variable name
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.variables.extracted.secure}}`
{% /dt %}

{% dd %}
Whether the variable value is obfuscated
{% /dd %}

{% dt %}
`{{synthetics.attributes.result.variables.extracted.val}}`
{% /dt %}

{% dd %}
Variable value (note: uses `.val`, not `.value`)
{% /dd %}

{% /dl %}

{% /tab %}
{% /section %}

## Step summary{% #step-summary %}

Path: `synthetics.attributes.result.steps`

Access step data by index, name, or ID to reference specific steps in your notification messages. Use these reference methods when working with step-related variables throughout this documentation.

Each step exposes the following properties: `.id`, `.status`, `.type`, `.duration`, `.description`, `.failure.message`, `.code`, and `.url`.

You can reference steps in three ways:

{% tab title="By index" %}
Use positive numbers to count from the beginning, or negative numbers to count from the end:

{% dl %}

{% dt %}
`synthetics.attributes.result.steps.0`
{% /dt %}

{% dd %}
First step
{% /dd %}

{% dt %}
`synthetics.attributes.result.steps.1`
{% /dt %}

{% dd %}
Second step
{% /dd %}

{% dt %}
`synthetics.attributes.result.steps.-1`
{% /dt %}

{% dd %}
Last step
{% /dd %}

{% dt %}
`synthetics.attributes.result.steps.-2`
{% /dt %}

{% dd %}
Second to last step
{% /dd %}

{% /dl %}

**Example:** `{{synthetics.attributes.result.steps.-1.status}}` returns the status of the last step.
{% /tab %}

{% tab title="By name" %}
Use the step name in brackets:

{% dl %}

{% dt %}
`synthetics.attributes.result.steps[Click button]`
{% /dt %}

{% dd %}
References the step named "Click button"
{% /dd %}

{% /dl %}

**Example:** `{{synthetics.attributes.result.steps[Click button].status}}` returns the status of the step named "Click button".
{% /tab %}

{% tab title="By ID" %}
Use the step's unique identifier:

{% dl %}

{% dt %}
`synthetics.attributes.result.steps.abc-def-ghi`
{% /dt %}

{% dd %}
References the step with ID "abc-def-ghi"
{% /dd %}

{% /dl %}

**Example:** `{{synthetics.attributes.result.steps.abc-def-ghi.status}}` returns the status of the step with step ID "abc-def-ghi".
{% /tab %}

Review the [conditional alerting](https://docs.datadoghq.com/synthetics/notifications/conditional_alerting/#send-alerts-to-a-specific-slack-channel-based-on-failed-step) page for an example of how to use the `synthetics.attributes.result.step` variable in a Slack notification based on a failed step.

### Accessing step properties{% #accessing-step-properties %}

Combine any reference method with a property:

- `{{synthetics.attributes.result.steps.-1.status}}` - Status of the last step
- `{{synthetics.attributes.result.steps[Click button].status}}` - Status of the step named "Click button"
- `{{synthetics.attributes.result.steps.abc-def-ghi.status}}` - Status of the step with step ID "abc-def-ghi"

## Further reading{% #further-reading %}

- [Learn how to manage monitors](https://docs.datadoghq.com/monitors/manage/)
- [Learn more about monitor templates](https://docs.datadoghq.com/monitors/templates/)
- [Understanding Synthetic Monitor Alerting](https://docs.datadoghq.com/synthetics/guide/how-synthetics-monitors-trigger-alerts/)
