Variables
Variables define the dynamic values that can be used inside your triggers. While tags define what action happens and triggers define when it happens, variables provide the data those actions depend on (e.g., page URL, click text, user attributes).
By using variables, you can make your triggers more flexible and context-aware. For example, instead of hardcoding a page path, you can use a variable to capture the actual page URL at runtime.
Variable Lifecycle
Definition – A variable is created with a name and type.
Reference – Tags and triggers call the variable when evaluating conditions or firing actions.
Resolution – When the condition is met, the system resolves the variable to its current value (e.g., current URL, clicked element ID, user email).
Step 1: Open the Variables Tab
From your Workspace, select Variables in the left-hand menu.
You will see a list of existing variables with the following details:
Name – the variable’s identifier.
Type – the data source (e.g., URL, Data Layer Variable, Custom JavaScript).
References – the triggers or tags where this variable is being used.
Last Edited – when the variable was last modified.
Actions – view, edit, or delete the variable.

Step 2: Create a New Variable
Click Create Variable.
Enter a Name for your variable (choose something descriptive, like Page URL or User Email).
Select a Type from the dropdown menu. Options include:
Utilities:
Constant – stores a fixed value.
Date Time / Date Time Zone – captures the current time.
Engagement – measures user time on site.
Local DB – retrieves stored values from local storage.
Browser – captures browser properties.
Lookup Table – maps one value to another.
Random Number – generates a random value.
Page Variables:
1st Party Cookie – retrieves cookie values.
Data Layer Variable – pulls data from the data layer.
Custom JavaScript – runs custom code.
JavaScript Variable – references global JavaScript values.
Page Elements:
DOM Element – captures attributes/text of an element on the page.
Navigation:
URL – retrieves parts of the current page URL (full URL, path, query, etc.).
Netmera Specifics:
Netmera User – retrieves user attributes managed by Netmera.

Step 3: Save and Reference the Variable
Click Save to create the variable.
Go to Triggers or Tags and use this variable in conditions or actions.
Example: Use the Page Path variable with the condition contains /checkout to fire a purchase event.
Example: Use the Click Text variable to fire a trigger only when a button with label Subscribe is clicked.
Using Variables in Triggers
Variables can be applied to filters inside triggers, making conditions more dynamic. Instead of setting a fixed value, you can use variables (like Page URL, Click ID, or Event Name) to evaluate the trigger at runtime.
Example: Page Path Variable in a Trigger
In this example, the trigger is set up as follows:
Type: Page View
Filter: Page Path → contains →
/checkout
This means the trigger will only fire when the user views a page whose path contains /checkout
.

How to Import a Built-in Variable
Sometimes, instead of creating a variable from scratch, you can import a predefined built-in variable. These cover common use cases such as capturing API responses, referencing Netmera user attributes, or adding debugging utilities.
Step 1: Open the Variables Tab
From your Workspace, select Variables in the left-hand menu.
Click Import Built-in Variable. This opens a selection panel.
Step 2: Select Built-in Variable Type
In the import panel, you can choose from the following categories:
API
Response Body – captures the body of an API response.
API URL – captures the full API endpoint.
Referrer URL – retrieves the referring page.
API Path – captures the API path segment.
Response Status – retrieves the HTTP response code.
Request Body – captures the content of the API request.
Netmera Specifics
Netmera User Tags – retrieves user tags from Netmera.
Netmera User Segments – retrieves the segment(s) the user belongs to.
Netmera User External ID – retrieves the user’s external identifier.
Netmera User Gender – retrieves gender from the user profile.
Utilities
Log Message – useful for debugging by printing values during Preview mode.
Step 3: Confirm Selection
Check the boxes for the built-in variables you want to import.
Click Save and Continue. The selected variables will now appear in your Variables list with their type and references.

Last updated
Was this helpful?