Variables
Capture dynamic content using variables
A tag can be used to record or transmit not only fixed values, but also dynamic information from the website. Content from cookies, the data layer, DOM elements or URL parameters can serve as sources. In the following, we explain how the individual tag types are filled and then used.
To configure variables, click on tag manager in the menu and select the sub-item My variables.

Cookie variable
Use the cookie variable to use cookie values for filling tag parameters. In addition to a name for the variable, all you need to do is enter the cookie name.

Data layer variable
The “dataLayer” variable is a Javascript array that is used by one or more tag providers simultaneously to store website events, among other things. The name of this variable is usually “dataLayer”. However, other names are theoretically possible. You can display the contents of the variable by simply entering the name of the Javascript variable in the browser console, e.g. “dataLayer”.
dataLayer = [
{
'event': 'pageview',
'category': 'Seite',
'action': 'Startseite',
'label': 'Übersicht',
'value': 1
},
{
'event': 'click',
'category': 'Button',
'action': 'Klick auf Button',
'label': 'Mehr erfahren',
'value': 2
}
];
The data layer variables can now be used to read data layers from a wide range of providers. To do this, enter the name of the data layer and the name of the corresponding variable.

In our example, for example, “Name of the data layer”=”dataLayer”, “Name of the data layer variable”=”event”. If there are several variables with the same name, the last one set will be used. Nested objects can be addressed with a dot (.). For example, “product.price”.
URL variable
Two options are available for the URL variable: GET parameter and Query. If GET parameter is selected, the value of a specific GET parameter can be used. To do this, simply enter the name of the desired GET parameter. If Query is selected, all content contained after the question mark is taken from the URL. This can be helpful if the query does not contain any key-value pairs, but only a value such as ?sorted, ?print or similar.
However, if key-value pairs exist and the variable is used to set its own dimension, the value of the URL parameter already defined in the dimension is automatically found and used.

DOM variable
For DOM variables, the element from which the value is to be obtained must first be specified. This is done using the usual selection between CSS selector, element ID and element class.

You can then define whether the variable should be filled with the text of this element or whether the value of an attribute from this element should be used. If attribute value is selected, the attribute name must be specified. This also makes it possible to read so-called “data-attributes”.
Constant variable
This is not a dynamic variable. Rather, it simplifies the reuse of information in any number of tags. This is practical, for example, for account data and access keys that are used for identification with third-party services.
Custom variable
The custom variable makes it possible to calculate and output values based on JavaScript code using any function. This allows variable values to be defined that are not available as templates. It offers a great deal of flexibility, as even complex logic is possible by extracting certain information from the DOM, performing calculations, combining different information and returning it.
Examples are the output of the timestamp, the retrieval of a form field value, currency conversions and the generation of random values.

Data provided by users

This is a special variable for the implementation of Enhanced Conversions for Google Ads, Meta Ads, TikTok Ads and Pinterest Ads. The encrypted transmission of email addresses directly at the time of conversion allows you to close attribution gaps and optimize the bidding strategies of your campaigns. The implementation of Enhanced Conversions is particularly easy and convenient via the etracker tag manager:
Select a previously created variable to read the email address from your store system or the DataLayer. We recommend using a DataLayer variable, as this is more “stable” than a DOM variable.
The rest happens automatically:
- If the server-side conversion upload is activated, the data is encrypted locally in the user’s browser using SHA-256 before it is sent to etracker and from there to the servers of the marketing platforms. This means that they never receive the real email addresses, but only cryptic values (e.g. d5a671c…) in order to match them with their own hashed user data. The etracker consent manager ensures that user data is only collected and sent with prior consent.
- If you use the conversion tags from Google, Meta, TikTok or Pinterest, the data is sent encrypted via the tags after prior consent.
Please note: When using Enhanced Conversions, the information provided in the consent dialog should be adapted. You can find sample texts here.
Use variables
To use a variable in a tag, the variable must be selected in the appropriate parameter of the corresponding tag. In addition to fixed designations, integrated variables are available for selection that refer to the value from the element to which the trigger relates. You can also use your own variables, which can be filled from the four sources mentioned above and are dependent on the selected trigger.
