This guide explains how to manage data layer variables.

This article contains the following sections:

Table of Contents Placeholder

Overview

The Data Layer screen offers several ways to manage the variables in your data layer.  Each variable that you implemented on your website must also be created here so that it can be used in your configuration. In addition to the dynamic data you populate in your site's Universal Data Object (UDO), a number of other built-in variables from your pages are available to be added from this screen.

Learn more about the built-in variables available in the UDO.

If you're unsure about what data might be available from a web page on which Tealium is installed, use the Universal Tag Monitor to quickly see what data is being collected.

Learn More: An Introduction to the Data Layer

Variable Types

The data layer screen organizes variables by type. The types are based on where the data for the variables comes from. The supported types are:

  • UDO Variables – variables from the Universal Data Object (utag_data).
  • Querystring Parameters variables from the URL query string.
  • First-Party Cookies variables stored as cookies.
  • JavaScript Variables variables that already exist in your site code.
  • Meta Data Elements variables from <meta> tags in the page's HTML.
  • DOM Variable built-in DOM variables (learn more).
  • AudienceStream Attributes variables imported via data layer enrichment from your AudienceStream account.
    WhiteUI_TiQ_DataLayerVariables_Filter.png

UDO Variable

This type is for variables defined in your Universal Data Object, also referred to as utag_data, which you can find in the code for your webpage. Most of your variables will be this type.

Example:

In the page: var utag_data = { language : "en", currency : "usd" };

Name in iQ: language and currency

Reference this variable with JavaScript in an extension: b["language"]

JavaScript Variables

Select this type to reference a JavaScript variable on your web page (other than the utag_data object). Normal syntax rules apply to the JavaScript variable type.

Example:

In the page: var myApp = { page : { name : "Home Page" } };

Variable name in iQ: myApp.page.name

Reference this variable with JavaScript in an extension: b["js_page.myApp.page.name"]

Querystring Parameters

Select this type to capture parameters from the URL. The query string consists of everything after the "?" character in the URL.

Example:

In the URL: http://example.com/path/file.html?sortOrder=price

Variable name in iQ: sortOrder

Reference this variable with JavaScript in an extension: b["qp.sortOrder"]

Select this variable type to reference the value in a cookie being set on your domain. When creating a cookie variable you can either specify the Tealium cookie,  utag_main , or a standard cookie. The examples below describe both methods.

The following table describes the set of default parameters stored in the Tealium cookie, which are available in the Tealium data bundle.

Cookie Parameter Description Version of utag.js
_st This is a number unique to the current page view. 4.011 and later
ses_id This is the timestamp to log the time spent by a visitor on your site. 4.011 and later
_ss This is a flag value (0 or 1) indicating the start of session. 4.26 and later
v_id This id value is unique to the visitor. 4.26 and later
_pn This is the page number (_pn) value which starts over at 1 with each new session and increments every time utag.js loads. 4.27 and later
_sn This is the session count. 4.27 and later

Tealium Cookie

To store data in the Tealium utag_main cookie, prefix the variable name with "utag_main_". For example, if you want to track affiliate referrals with a cookie named "aff" and you want to store this value inside the Tealium cookie, name it "utag_main_aff".

Reference this variable with JavaScript in an extension: b["cp.utag_main_aff"]

Non-Tealium Cookie

To store data in a non-Tealium cookie, create a new Variable called "aff" with a type of cookie value. You can set the cookie value using the Persist Data Value extension.

Reference this variable with JavaScript in an extension: b["cp.aff"]

Understanding when to use each type of cookie is important when trying to save cookie space. We recommend that you use the Tealium cookie as much as possible. However, if you're using the Split Segmentation extension, then you must use a non-Tealium cookie.

For more information on how to use cookies with Tealium, please see the Tealium Cookies article.

Meta Data Elements

Select this type to reference the content of a meta tag in the page.

Example:

In the page: <meta name="author" content="Tealium" />

Variable name in iQ: author

Reference this variable with JavaScript in an extension: b["meta.author"]

DOM Variable

These are built-in DOM variables that cannot be modified. They are set automatically in the page.

Learn more about built-in utag.js variables.

Adding Variables

This section describes how to add single variables or import bulk variables.

Add a Single Variable

Use the following steps to add a single variable:

  1. Navigate to the Data Layer tab and click Add Variable.
    The Add Variable dialog box displays.
  2. Enter the following fields: 
    • Source (required) the name of the variable exactly as it appears in your site's source code
    • Type  (required) the type of variable, as specified above
    • Alias an additional name for the Variable, usually if the Source name is not intuitive
    • Notes useful comments about the Variable, especially useful for the next person that uses your account
      WhiteUI_TiQ_DataLayer_AddVariable_Dialog.png

If intended for use in AudienceDB, column names for variables may contain any ASCII characters other than double quotes.
If intended for use in EventDB, column names for variables must consist of only UTF-8 printable characters. ASCII characters in standard and delimited identifiers are case-insensitive and are folded to lower case. For additional details, see Amazon Web Services - Names and identifiers.

Bulk Import Multiple Variables

Adding variables individually can take some time. Tealium iQ provides an easy way to add numerous variables at the same time with the Bulk Import from CSV option.

Use the following steps to add variables using the Bulk Import from CSV option:

  1. Click the down arrow to the right of the  + Add Variable button to reveal more options.
  2. Select Bulk Import from CSV.
    WhiteUI_TiQ_AddVariables_DropDownList.png
    The Import Variables dialog displays.
  3. Enter the variables you want to add into the text box with a comma-separated values (CSV) format. There are a few things you should be aware of:
    • Each variable entry supports four values in this order:
       Source, Type, Description (optional), Alias (optional)
      These correspond to the same values you would enter if you were adding a variable from the Add Variable dialog.
    • These values must be separated, or delimited, by a comma.
    • You may enclose each value with quotes, but they are not required.
  4. Click Apply to upload the variables.
    WhiteUI_TiQ_BulkImportVariablesSampleCode.png

Checking the Replace All Variables box will remove the all of the current variables and replace them with the variables you enter in the text field. 

Data Bundles

Data Bundles are the easiest way to quickly build your data layer based on the most commonly used variable names and Tealium's best practices. The variables are grouped into bundles that are organized by their typical use. There are Standard Bundles ranging across a variety of uses from E-Commerce to Mobile Apps and Provider Bundles from services such as as Demandware and WordPress.

The E-Commerce bundle will automatically add and configure the E-Commerce extension.

Access the Bundles

Use the following steps to access variable bundle types:

  1. Click the drop-down list on the + Add Variable button.
  2. Click Add Common Variables.
    WhiteUI_TiQ_AddCommonVariables_DropDownList.png

The Common Variables Dialog

The following list provides a summary of the Common Variables dialog:

  • Bundles  Collection of variables you can choose to add to the Data Layer.
    • Standard Bundles contain common variables grouped according to their use case.
    • Provider Bundles contain provider- or platform-specific variables.
  • Import This Bundle  Clicking this button automatically adds the bundle to your Data Layer.
  • Resources  List of supporting help docs.
  • Variable List – Description of variables in the bundle you are currently viewing.
    WhiteUI_TiQ_ImportCommonVariables_SectionsHighlighted.png

Import a Bundle

Use the following steps to import a bundle:

  1. From the categories on the left, select the bundle that you want to import into your data layer.
  2. Click Import This Bundle.

    Adding a bundle will not overwrite your existing data layer variables.

  3. Navigate to the Data Layer tab to view the newly added variables.

Viewing Variable Details

When you expand the variable summary to show the details, a list of the dependencies displays. The dependencies make it easy to see which tags, load rules, and extensions are referencing this variable. This is also where you can edit or delete a single variable. In addition, you can apply new labels or manage any existing labels.WhiteUI_TiQ_ViewAndEditVariables.png

Bulk Edit

Clicking the Edit All button launches the following dialog, from which you can make changes to any and all variables.

You cannot delete variables from the "Edit All Variables" screen. 

WhiteUI_TiQ_EditBulkVariables.png