The data layer is the foundation of your Tealium solution and served as the one true definition of your data across all digital assets and customer interactions. The data layer comprises all of the various variables that are collected across your site and the visitor interactions and events that are tracked.
The following is an example declaration of utag_data:
Define and populate the utag_data object variable prior to loading the Universal Tag (utag.js).
When utag.js loads in the page, it looks for the utag_data variable and uses the data to automatically trigger a page view tracking call with utag.view(). If you have a single page application, or are calling utag.view() manually, you might not need utag_data.
Use string values for all variables, including boolean and numeric data.
Enclose all values in double quotes or single quotes and escape any quotes that might appear in the value itself. For example, utag_data.page_name = 'It's All About the Data!';.
For boolean values use "1" and "0" to represent true and false. This is the simplest way to represent a boolean using strings.
Use strings for all dollar amounts and exclude all currency symbols and commas. For example, utag_data.order_total = "1234.00"; instead of "$1,234.00".
Use array values for all product related variables. The Tealium library, and each vendor tag integration, is designed to use arrays for all product-related data. For example, ID, price, or quantity. utag_data.product_id = ["P1234", "P4567", "P7890"];
Avoid Extra Code
Do not add extra code to the UDO script block. If any code in the same script block fails, the UDO may not be defined correctly which might lead to unexpected data being passed to your vendor tags.
The following is a sample UDO as it appears on a page. This specific example shows properties that might appear on a “Shopping Cart” page with two products in the cart.
When populating the UDO, only include variables pertinent to the current page type. This reduces clutter in the page code and eliminates confusion about what data is expected. Below is an example of a search page UDO that omits unnecessary items such as product and order data.
Product variables are to be populated as arrays, even when a single product is being set. Below are examples of setting the product ID variable with one product ID (on the Product Detail page) and with three product IDs such as a Shopping Cart page.
// Single product. For example, product detail page
utag_data["product_id"] = ["PROD123"];
// Multiple products. For example, cart page
utag_data["product_id"] = ["PROD123", "PROD456", "PROD789"];
All product array variables must have the same number of elements to ensure data alignment. In this example, notice that the first element in each array corresponds to the first product. Properties associated with this product (such as ID, price, and quantity) all appear in the first element in each array, while the properties of the second product appear in the second element in each array, and so on.