Understand Variables
A variable is a named value that the container can reuse in tags, trigger conditions, and other variable settings.
Variables turn page data into template keys. A variable named order_id can be
inserted into a tag field as {{order_id}}. When the container runs, Nitoriq
resolves the variable, applies any formatting steps, and replaces the template
with the final value.
Variable Sources
Variables can read values from:
- the current URL, query string, or referrer
- first-party cookies
- JavaScript values on the page
- the Nitoriq data layer
- the GTM
window.dataLayer - DOM elements
- the current click or form event
- constants and generated random numbers
Built-in variables are available without creating a custom variable. Custom
variables are created in the Variables tab.
Resolution Order
At runtime, a variable resolves in this order:
- The variable type reads the source value.
- The type-specific default value is used when that source is empty.
- Formatting steps run in the order shown in the editor.
- The final value replaces the
{{variable_name}}template.
If a variable references another variable, Nitoriq resolves the dependency first. The compiler checks for dependency cycles before publishing.
Draft And Publish Behavior
Creating, editing, duplicating, or deleting a variable changes the container draft.
The installed script receives the variable changes after the container is published. The published runtime includes variables that are referenced by tags, triggers, or other used variables.
Variable record fields
Name
The template key used in fields such as {{order_id}}.
Names must be unique and cannot use built-in variable names.Type
The source the variable reads from.
The type controls which settings appear in the editor.Settings
Type-specific values such as selector, cookie name, path, component, or fixed value.
Settings define what the runtime reads before formatting.Formatting
Optional transformations applied after the variable resolves.
Formatting can trim, change case, add defaults, replace text, or URL encode the final value.Was this page helpful?