Tag variables are placeholders for values that may change from one website or campaign to another (e.g. an identifier or “ID”). Using variables in tags allows you to build dynamic tags and use the right value based on the context. In this article, we will explore how this concept works together with the Tag Library. Let’s start off with the basics.
What are tag variables in Qualifio?
Tag variables are used to store values that vary depending on the context (e.g. a tracking ID or a store code) and pass this information to tags. The variable is replaced with data at the time that the campaign is loaded.
Tag variables have several benefits that can help marketers take their tagging game a step further:
- Tag variables are used for storing values that you’ll use frequently, and the value is defined only once (unless you decide it should be defined on a per-campaign basis). Thus, if you change the value, you only need to update it once: in the variable. A time-saving solution when configuring tags!
- You can use a variable name that is logical and descriptive.
The most common use case of tag variables is the tracking ID: with a tag variable, you won’t have to go to Google Analytics Admin to copy the ID each time you want to configure a tag. Nor will you have to create a new tag in Qualifio for each different ID while the rest of the tag is exactly the same. Instead, you’ll only keep the “ID analytics” variable name in mind.
However, it should be said that one can work with the Qualifio Tag Library and not need any variable. Example: if all of your teams use the same Google Analytics tracking ID, you may just as well insert that ID directly in the tag and skip the variable creation part.
How to set up a tag variable
You can create tag variables to suit your specific requirements. To do so, follow the below steps:
- Navigate to the Privacy section and open Tag Library
- Click Tag variables.
- Click Create a variable or the + sign.
- Name the variable. Use a name that is unique and descriptive of the variable’s function.
- To specify the variable’s value, you’ll see three options you may choose from:
- Default value for all campaigns: the variable stores a static value that is the same throughout your whole account. This is useful to avoid empty values, as the default value will be used when we don’t have a more specific one.
and/or
- Values for specific campaigns: if you activate “Default and website values can be overridden in campaigns”, then users might need further configuration in some campaigns (look at this example).
and/or
- Values for specific websites: the variable stores a dynamic value that changes based on the website on which your campaign is published.
Don't forget to click Save.
Now you have defined a new variable to feed data in your tag.
How to use variables for tag configuration
In the Tag Library > Tags, select or create a tag and click on the {} Variables button:
You will get a screen like the below image. Select a variable from the list to insert into the tag:
Here’s an example tag created with a variable:
How to override tag variable default values
If default and website values can be overridden within campaigns, users might need further configuration when using tags with this variable in their campaign.
Overriding default values can be required or optional. If you chose to “Mark value as required in campaigns”, users must provide a value. If you didn’t, users can omit it. If no value is set for that variable, the default value is used.
If you have any questions about variables for tags, email Support or contact your account manager today.