Configuring Multiple Floodlight Tags
This articles describes how to set up multiple Floodlight tags in your Tealium iQ Tag Management account.
If you have many Floodlight tags, all with a slightly different configuration, but based on the same load criteria, for example, different paths in the URL, rather than setting up several similar instances of the Floodlight tag, each with different load rules and configuration values, you can combine them into one instance of the Floodlight tag using some additional configuration.
Google recommends migrating to the Google global site tag by implementing the Floodlight tag.
How it works
This multi-tag solution uses data mappings to set the Floodlight parameters dynamically and a lookup table to set the Floodlight values based on a data layer variable. The lookup table creates a delimited string containing multiple values per entry which can then be separated into individual Floodlight parameters using a JavaScript Code extension.
New data layer variables
You will need the following variables for the data mappings in the Floodlight tag and for the lookup table extension. The “dc_” prefix is a best practice to remind you that these variables are used for the Floodlight configuration.
Create the following:
- dc_advertiserId (mapping)
- dc_type (mapping)
- dc_category (mapping)
- dc_counterType (mapping)
- dc_settings (lookup table extension)
Data mapping
In this multi-tag solution the Floodlight parameters will be set dynamically based on the output of the lookup table extension, so the values must be set in the tag configuration using data mappings.
Set the following data mappings:
dc_advertiserId
set tosrc
dc_counterType
set tocountertype
dc_type
set totype
dc_category
set tocat
Once completed the mappings will look like this:
Extensions
This solutions uses three extensions to construct all of the Floodlight tags we intend to fire. The following extensions will be added and must be ordered as they appear here:
- Lookup Table
This sets a delimited string based on the selection criteria (in this case we will be using the URL pathname). - Set Data Values
This converts the delimited string from the lookup table into the separate Floodlight variables. - JavaScript Code
This verifies that a value exists for the tag to fire, otherwise it suppresses the tag.
Lookup table extension
This extension will be used to set a delimited string based on a criteria variable. In this example, the criteria variable is the pathname
variable and the delimited string is the dc_settings
variable set in the following format:
ADVERTISER ID|TYPE|CATEGORY|COUNTERTYPE
To add this extension:
- Add a Lookup Table extension.
- Set the Title. For example, “DC Settings”.
- Set Scope to the Floodlight tag you just added.
- Set Lookup Value In:
pathname
- Set Destination:
dc_settings
- Set Variable Type: String
- Set Match Type: Contains
Each lookup table entry will contain a URL pathname and a delimited string value. This example uses the following entries:
Pathname | Output |
---|---|
/test1/test | 321123 |
/test2/test/something.htm | 321123 |
/test1/docs | 321123 |
The Lookup Table extension should appear as follows:
Use the Import from CSV… option to manage long lists.
Set data layer extension
This extension will separate the delimited string into separate Floodlight variables.
To add this extension:
- Add a Set Data Values extension.
- Set the Title e.g. “Floodlight Parameters”.
- Set Scope to the Floodlight tag you just added.
- Set a variable for each of the Floodlight parameters:
Set Variable | Value Type | Value |
---|---|---|
dc_advertiserId | JS Code | b[‘dc_settings’].split("|")[0] |
dc_type | JS Code | b[‘dc_settings’].split("|")[1] |
dc_category | JS Code | b[‘dc_settings’].split("|")[2] |
dc_counterType | JS Code | b[‘dc_settings’].split("|")[3] |
The extension should appear as follows:
Use the Add Condition to test that dc_settings
is populated to ensure this will only run when there is a value.
JavaScript code
This extension will suppress the Floodlight tag if the lookup table extension did not output a value (i.e. there is no tag to fire). This means that you can keep the “All Pages” load rule set on the Floodlight tag and it will not fire if there is no configuration for the current page.
To add this extension:
- Add a JavaScript Code extension.
- Set the Title e.g. “Check Value”.
- Set Scope to the Floodlight tag you just added.
- Enter this code:
if(b['dc_settings']===''){
return false;
}
- Publish your changes for testing.
This page was last updated: July 16, 2022