This article reviews our best practices associated with implementing and managing your data layer.

In this article:

Table of Contents Placeholder

Naming Conventions

The goal of the data layer is to provide a set of variables that are vendor-neutral and easy to understand. The following best practices apply:

  • Use lowercase, underscore-separated variable names.
    Examples: site_section, product_unit_price, login_status.
  • Avoid vendor specific naming.
    Avoid eVar1, pv_a3, or oid.
  • Use meaningful variable descriptions.
    Sometimes even a properly named variable still needs additional clarification. A good variable description will include details about when and where a variable is set, which vendor is using the variable, and possible values to expect in the variable. Examples:
    • "Login status 'anonymous' or 'authenticated', used for eVar1 in Adobe Analytics."
    • "Order subtotal does not include tax or shipping, exclude commas and currency sybmols."
  • Avoid pluralized variable names.
    Variables that contain multiple values, such as the product array variables, should use the singular form of the name. Examples:
    • "product_category" instead of " product_categories"
    • "product_id" instead of " product_ids"
  • Prefix boolean variable names with " is_" or "has_".
    This allows you to quickly identify variables that will contain a value of "1" or " 0". Examples: is_registered, is_first_time_visitor, is_logged_in
Pros Cons
Creates a consistent naming convention. Additional effort to transition vendor-specific variables to vendor-neutral naming convention.

Easier for new users to understand what is available in your data layer and how each variable is used.


Tealium Support is familiar with this convention.


String Variables

Use string values for all non-product variables. Boolean and numeric variables should be passed as strings.

For boolean values, we recommend using "1" and "0" instead of true and false. This approach is more stable and reduces confusion about the expected values in these variables.


  Boolean Integer
is_registered : "1"
order_total : "1234.56"
is_registered : true
order_total : 1234.56


Pros Cons
Tag templates expect strings and arrays. None
Minimizes testing effort during and after implementation,.  

Array Variables

Set product variables (price, quantity, ID, etc.) as arrays. The Universal Tag (utag.js) is designed to use arrays for all product variables. While it is possible to set product values in a comma-separated string, this approach is more prone to errors.

Array (Recommended):

product_id : ["prodID1","prodID2","prodID3"]


product_id : "prodID1,prodID2,prodID3"

Pros Cons

Same format expected by vendor tag templates.


Improves readability of the data layer.


Page Type Identifier

All pages of your site should include a variable called page_type. This is used to determine the type of page the user is viewing. The suggested values include, but are not limited to:



Home Page


Category / Product List


Product Detail


Search Results


Cart / Basket


Checkout Flow (User Info, Billing Address, Shipping Address)


Order Confirmation / Thank You



Pros Cons

Gives a clear understanding of what kind of page the user is viewing

Upfront development effort to add page_type variable in UDO

Many vendor tags utilize a page-type identifier to function properly


Third-Party Data Layer Objects

You might already have a data layer object implemented on your site, such as the W3C Data Object or your own custom object. We recommend that these objects be converted to the Universal Data Object (UDO) utag_data using one of the available data layer converters.

Pros Cons

Better compatibility with built-in functionality, such as load rules, data mappings, and Web Companion,

Additional effort to implement.

Reduces support costs to investigate issues with your custom object.


Set utag_data Before utag.js

In the page code, the Universal Data Object (utag_data) must be declared before the reference to the Universal Tag (utag.js). This ensures that the Universal Tag has all the data layer variables needed to evaluate load rules, extensions, and tags. A sample of your code can be accessed from Code Center.

Learn More: Code Center