- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
This article shows how to set up and configure the Tealium Generic Tag, a one-size-fits-most generic tag container used for implementing almost any third-party vendor image, iframe, or script-style tag to your pages.
In this article:
This tag supports one of three types: image, iframe, or script. Identifying the type of tag you are working with is important, so here are some clues to look for when setting up your tag. If the code for your tag matches any of these patterns, then choose the corresponding tag type in the tag configuration.
Image tag code snippets usually contain one of the following:
new Image()
<img src="https://
document.write("<img src=" ... ">");
Iframe tag code snippets usually contain one of the following:
document.createElement('iframe')
<iframe src="https://
document.write("<iframe src=" ... "></iframe");
Script tag code snippets usually contain one of the following:
<script type="text/javascript" src="//example.com/tag.js"></script>
document.createElement('script')
To configure the Generic Tag you will need to understand the following components that make up your tag.
The base URL is the hostname, pathname, and file pointing to the location of the pixel. It does not include the "?" character or the query string parameters.
In our sample pixel above, the base url is: //www.example.com/tag.gif
Many tags collect data by using the query string of the URL. These are the key/value pairs that appear in the URL after the "?" character. In our example the parameters are:
cid=112233&rg=us&rnd=' + rnd_nocache + '&ref=' + referrer
Static parameters have values that you can see in the snippet and do not change from page to page. In this example, the static parameters are:
cid=112233
rg=us
Dynamic parameters are values that change from page to page. In this example, the dynamic parameters are:
rnd=
ref=
Dynamic parameters can be configured using data mappings or using value substition.
It's common for vendor tags to require a cache bust variable in the query string. This value is randomly generated and added to URLs to prevent the browser from caching the request. Our example includes a cache busting variable called rnd
.
This functionality is built into the Generic Tag. Simply enable the cache bust setting and specify the name of the cache bust parameter and the Generic Tag will generate and assign the random value for you.
First, go to the Tag Marketplace and add the Generic Tag to your profile (how to add a Tag?).
After adding the Tag, configure the below settings:
This tag supports dynamic value substitution, which allows you to reference data layer variables directly in the Base URL, HTTPS URL, or Query String configuration fields. This provides the flexibility to create a dynamic tag based on your data layer. To use a data layer variable in a field, reference the variable name by surrounding it with "@@". For example, to insert a data layer variable named "account_id" into the path of the URL, enter a value like this: //example.com/path/@@account_id@@/i.gif
Each type of data layer variable can be substituted using the following prefixes:
@@variable@@
@@js_page.variable@@
@@meta.variable@@
@@qp.variable@@
@@cp.variable@@
Load Rules determine when and where to load an instance of this Tag on your site.
Mapping is the process of sending data from a Data Layer Variable to the corresponding destination variable of the vendor tag. For instructions on how to map a variable to a tag destination, see Data Mappings.
The Tealium Generic tag supports custom mappings only. You set a custom destination name in the text field.
All data mappings are appended to the query string parameter of the tag URL as key/value pairs.
If your tag requires code to run after the main library has loaded you can use the callback function.The Generic Tag defines an internal callback property named u.callback
that you can redefine within a tag-scoped Javascript Code extension. Simply create a new extension, add your callback code, and scope it to the Generic Tag. This code will then run after the tag code has executed on the page.
The u.callback
function cannot be used when the Generic Tag type is set to "image".
Example:
// Put this code in a Javascript Code extension scoped to the tag.
u.callback = function() {
console.log("The tag has loaded, now do cool stuff!");
}
Copyright All Rights Reserved © 2008-2023