Skip to Content
Tag ManagerVariablesCreate And Manage Variables

Create And Manage Variables

Use the Variables tab to create reusable values for tags, trigger condition values, and variable templates.

Each custom variable has a name, type, type-specific settings, and optional formatting. The variable name becomes the template key.

The New Variable editor defines the variable name, type, template preview, formatting steps, and enabled state.

Create a variable

Open Variables

Open the container, then choose the Variables tab.

Create a new variable

Choose New Variable.

Enter a variable name. The editor converts spaces to underscores. Variable names can contain letters, numbers, underscores, and hyphens.

Examples:

  • order_id
  • product_sku
  • checkout_value
  • offer_click_id

The editor shows the template form under the type settings. For example, the variable name order_id becomes {{order_id}}.

Choose the variable type

Select the type that matches where the value lives.

The selector groups types by source, such as navigation, page variables, page elements, and utilities.

Configure the variable

Fill in the type-specific fields, such as parameter name, cookie name, selector, data-layer path, JavaScript path, or constant value.

Add formatting if needed

Open Variable Formatting when the resolved value needs transformation. Formatting steps run top to bottom after the source value is read.

Save the variable

Choose Save.

The variable is now available in template pickers and can be inserted as {{variable_name}} in fields that support variables.

Manage Existing Variables

The Variables table includes search and row actions.

Variable table actions

Search

Filters variables by name, type, group, and type description.

Use it to find variables in containers with many reusable values.

Edit

Opens the variable editor with the current settings.

Saving updates the draft variable record.

Duplicate

Creates a copy with a generated copy name.

The copied variable can be edited separately from the original.

Delete

Removes the variable from the draft.

Templates or condition values that still reference the deleted name need to be updated.
Validation

A variable is ready when

  • the name is unique
  • the type matches the source of the value
  • the selector, path, cookie name, parameter name, or fixed value is set
  • any default value is set where the type supports one
  • formatting steps are in the intended order
  • templates using the variable reference the saved name

Was this page helpful?