Use Variable Templates And Formatting
Templates insert variable values into fields that support dynamic text.
Custom variables and built-in variables use double braces. For example, a
custom variable named order_id is inserted as {{order_id}}.
Template Syntax
Use {{variable_name}} anywhere a template-enabled field accepts text.
The placeholder name can contain letters, numbers, underscores, and hyphens.
Template matching is exact, so {{order_id}} and {{Order_ID}} are different
names.
Examples:
{{niq_click_id}}
{{order_id}}
{{checkout_value}}
https://partner.example/pixel?click_id={{niq_click_id}}&order={{order_id}}Template-enabled fields appear in tag settings, variable default values, constant variables, and trigger condition values.
Insert Variables From A Picker
Template-enabled inputs include an insert-variable button.
The picker lists built-in variables and saved custom variables. Selecting a row inserts the template at the current cursor position.
If a template references an unknown placeholder, publishing can warn about the missing placeholder. At runtime, unknown placeholders resolve to an empty value.
Formatting Order
Formatting belongs to the variable. It runs after the variable type reads the source value and after the type-specific default value is applied.
Available formatting operations:
TrimLowercaseUppercaseDefault if emptyPrefixSuffixReplaceRegex replaceURL encodeURL decode
Formatting steps run top to bottom. A value can be trimmed, lowercased, given a fallback, and URL encoded in one sequence.
Replace Settings
Replace finds plain text and replaces it. It includes toggles for replacing
all matches and case-sensitive matching.
Regex replace uses a regex pattern, flags, and replacement text. Regex
validity is checked when the container is compiled for publish.
URL Values
URL encode converts the final value for safe placement in a URL component.
URL decode reverses URL encoding when the source value is encoded.
Use a variable in a tag
Create the variable
Create the variable and save it.
Add formatting if needed
Open Variable Formatting and add formatting operations in the order they
run.
Insert the template
Open the tag field that needs the value and insert the template, such as
{{order_id}}.
Publish the container
Publish the container so the installed script can use the saved variable and formatting sequence.
Templates are working when
- every placeholder points to an existing custom or built-in variable
- formatting steps are in the intended order
- regex formatting steps compile successfully
- URL values are encoded when the receiving field needs URL-safe text
- the published tag sends resolved values instead of raw
{{variable_name}}text
Was this page helpful?