- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog TLC Blog
- Support Desk Support Desk
This article describes how to configure tag data mappings to send data from your data layer to your vendor or to override tag configuration values.
In this article:
A data mapping is a connection between a data layer variable and a vendor tag. Data mappings determine which variables are used by a tag.
For example, a tag might collect page name information in a parameter named pName
, but your data layer might store this value in a variable named page_name
. To send the value of page_name
to pName
, you create a data mapping. Once the mapping is configured, the value of page_name
will always be passed to the vendor parameter pName
when that tag is triggered.
Each vendor tag has a list of available parameters that can be mapped called a mapping toolbox. In this window, browse the categories to find the desired vendor parameter(s).
There are two types of data mappings: variable mappings and custom values. Mapping a variable is the most common type since it allows dynamic values to be passed to the same vendor parameter. However, a custom value mapping is a convenient method for applying special logic in a mapping without using an extension. The custom value can be a plain-text value or a snippet of JavaScript code.
A tag vendor has a parameter for currency code, named curr
, to be set to the three-character code matching the currency of a transaction. If the tag will be loaded on pages that handle all types of currencies you will likely have a data layer variable called site_currency
or currency_code
that will be set to the appropriate value based on the activity of the user. The expected values might be "USD", "CAD", "GBP", "EUR", "JPY", etc. The data mapping would look like this:
A tag vendor has a parameter for currency code, named curr
, but the tag will only be deployed to a single geographic region where the currency will always be the same (such as "CAD"). In this case, a data layer variable is not necessary and the expected currency code, "CAD", can be set directly as a custom value mapping, like this:
The custom value can also be JavaScript code. This option is used if you want to pass a JavaScript number, boolean, or array value to the vendor parameter. You can use advanced statements or even an inline function. In this example, the mapping will be set to "GBP" if the hostname
contains "co.uk", otherwise set to "USD", using the following line of JavaScript.
location.hostname.indexOf("co.uk") > -1 ? "GBP" : "USD"
To reference a data layer variable such as page_name
, use the b
object like this b['page_name']
. Learn more about the b object.
Vendor tag parameters (also called destinations) are built into the Data Mappings configuration screen for the tag. This is where you add and manage data mappings.
Use the following steps to create a new data mapping:
Use the following steps to create a data mapping that uses a custom (static) value instead of a data layer variable:
When two or more variables are mapped to the same destination, such as page_name > pageName and Document Title > pageName, the last mapping takes precedence. Data mappings can be reordered to account for this precedence.
In this example, if both page_name
and document title
are populated, the destination variable pageName
will receive the value from document title
. If the variables are populated, the last mapping takes precedence.
If a variable does not have a value, the mapping is not applied.
While the built-in destinations cover most of your mapping needs, you can optionally define a custom data mapping to send data to a vendor parameter that you name.
Use the following steps to create a custom data mapping:
Use the following steps to edit the destination variable:
AudienceStream attributes are enriched attributes about your visitors that are sent back to your website for use with personalization.
The following requirements must be in place to map an AudienceStream attribute:
Use the following steps to edit a destination for a mapped variable:
Use the following steps to delete a destination for a mapped variable:
No warning or confirmation message displays. The destination dropped (deleted) is removed and cannot be restored.
You can drag and drop data mappings in your preferred order. This is helpful if you want to order your mappings alphabetically for better organization. The only time ordering matters is when two or more data layer variables are mapped to the same vendor destination. In this case, the last mapping takes precedence.
Copyright All Rights Reserved © 2008-2021