The data layer is the foundation of tag management.

In this article:

What is the data layer?

Data Layer stackThe data layer defines attributes about your website, such as site language or page name, as well as important visitor activity, such as a purchase or login. The first step in implementing tag management is to define the attributes of your data layer. The primary development effort required to implement tag management is to add the data layer to your website page.

How It Works

Before you add your first data layer variable, let's review how the data layer works:

  • JavaScript Object
    Most data layer variables added to your configuration must also be added to your website page code as properties of a JavaScript object named utag_data, also known as the Universal Data Object (UDO).
  • Data Layer Configuration
    To use the data layer in iQ Tag Management, you must add each variable in your configuration. The names of these data layer variables must match the names of the variables used in your page code. For example, a data layer variable named page_name in your configuration would appear in your web page code as utag_data = { "page_name" : "My Home Page" };
  • User-Friendly Variables
    Data layer variables should have user-friendly names that are vendor-neutral and easy to understand across all of your business units. For example, use order_id instead of oid.
  • Additional Page Data
    In addition to the variables you define, the data layer can also make use of the following data from your web pages: meta data tags, URL components, query string parameters, cookies, and other global JavaScript variables.

Add Common Variables

The first step in creating your data layer is to add a variable. In this step, add a bundle of variables named "Base Variables" that are common variables on most sites. Specifically, this bundle includes a variable namedpage_type that is used throughout this guide.

Follow these steps to add the variable bundle named "Base Variables":

  1. Navigate to Data Layer.
  2. In the upper-right, click + Add Variable and select Add Common Variables.
    getting-started-iq-data-layer-add-variable-menu.png
  3. In the side panel, under Standard Variables, select Base Variables.
  4. Click Import This Bundle on the upper right of the window.
  5. Click Close to close the window.

getting-started-iq-data-layer-basics-variable-not-saved.pngNotice how the new variables are marked with an orange asterisk (*). The color orange indicates unsaved changes. Don't worry about saving yet, you will save all of your work in the final steps.