The Hosted Data Layer extension is a component of the Hosted Data Layer feature. The extension is used to configure which variables from the on-page data layer are used to fetch hosted data layer objects.

For an overview of this solution, see Introduction to Hosted Data Layer.

In this article:

Table of Contents Placeholder

Prerequisites

  • utag Version 4.43 or above
    Requires utag version 4.43 or above. (How do I upgrade utag.js?)
  • Lookup Variables
    Lookup variables are the shared link between the on-page data layer and the hosted data layer objects that contain supplemental data.

    The values of the lookup variables become the names of the hosted data layer objects.

How It Works

This section describes how the Hosted Data Layer extension works as utag.js loads on a page:

  1. The Hosted Data Layer extension executes early and halts utag.js for a duration up to the specified value in the Timeout setting.
    While paused, utag.js will not evaluate tags, load rules, or extensions.
  2. The Hosted Data Layer extension then scans the on-page data layer (utag_data) for the specified lookup variables.
  3. If the lookup variable exists, the extension queries the CDN for the matching Hosted Data Layer object with the same name as the lookup value.
  4. If the ".js" file exists on the CDN, the extension fetches the ".js" file.
    The lookup is deemed successful.
  5. If a Hosted Data Layer object is found on the CDN the extension will merge that data into the on-page data layer.
    Duplicate variables are handled according to the following setting of the Overwrite on merge setting:
    • Overwrite on merge: Yes
      Variables in the on-page data layer are overwritten by variables from the incoming object.
    • Overwrite on merge: No
      Variables in the on-page data layer are preserved.
  6. utag.js continues operation when merging is complete or the timeout has expired, whichever occurs first.
  7. Load rules and extensions are evaluated and tags are fired accordingly.

Configuration

Use the following steps to configure the timeout extension:

  1. Go to the Extensions marketplace and add the Hosted Data Layer Extension from the Standard tab.
    For detailed instructions, see How to add an Extension.
  2. In the Title field, enter a descriptive title.
  3. Scope and Execution
    This field is set by default to ensure that the extension can run for all tags prior to the evaluation of the Load Rules.
  4. Click +Add Variable.
  5. Select the appropriate variable from the drop-down list.
  6. Repeat these steps for each addition until complete.

    The Timeout extension performs the lookup in a sequential order. In the following example configuration, "page_name" is looked up first, followed by the "product_sku" then "customer_zip".

    configuration.png 
  7. Overwrite on Merge (default YES)

    If a key exists both in the incoming and recipient data layers the incoming key-value overwrites the existing instance by default.
    If you prefer to preserve the existing key-value instance, you must toggle this setting to NO.
  8. Timeout (seconds)
    The default setting is 30 seconds. You may change this setting depending on the time estimated to complete the merge.
  9. When complete, click Save & Publish to save and publish the profile.

Frequently Asked Questions (FAQ)

What happens if the hosted Hosted Data Layer object is not found on the CDN?

The lookup can fail for two (2) reasons: either the name of the hosted data layer object is defined incorrectly or it is not defined at all. Regardless of the reason, the extension will receive an empty object and there will be no enrichment. 

Ensure that the value of the lookup variable in the on-page data layer matches the name of the Hosted Data Layer object uploaded to the CDN. Use the Hosted Data Layer API to verify that the expected Hosted Data Layer objects are uploaded to the CDN. 

What happens if the lookup variable is not in the on-page data layer?

The extension releases the halt on utag.js and it runs as usual. There will be no lookup and the on-page data layer remains unchanged.

The following example shows how the data layer looks before and after merging:

Original Data Layer Incoming Variables
{
    "product_category" : "shoes"
    "product_sku"      : "GEN-PRD-BLU"
}
{
    "product_category"   : "boots"
    "has_instore_pickup" : "1"
} 

 

After Merging: Overwrite YES After Merging: Overwrite NO
{
   "product_category"   : "boots"
   "product_sku"        : "GEN-PRD-BLU"
   "has_instore_pickup" : "1" 
}
{
    "product_category"   : "shoes"
"product_sku" : "GEN-PRD-BLU"
"has_instore_pickup" : "1" }

Can I use this extension without the API component?

No. You must upload data layer objects to the CDN prior to using this extension.

Can I change the scope of the extension?

No. The scope and the execution drop-down list is predefined to ensure that the extension can automatically run before all load rules and tags are processed.

Does this extension affect page loading?

Running this extension will introduce a slight slow down in tag firing since the hosted data layer objects must be returned before operation can complete.

Is it possible to chain together lookup variables (ie. use a variable from a hosted data layer object as a lookup variable)?

No. The lookup variables must exist in the on-page data layer at the start of the extension, they cannot be populated by a previous lookup variable (hosted data layer object). 

Does enrichment work with event tracking or subsequent calls to utag.view, utag.link, or in a single-page application environment?

No. The extension is designed to run once per page load. 

Can this extension be used in mobile installations?

No. Mobile installations (iOS/Android/etc.) do not support the Hosted Data Layer extension.

What happens if the extension fails to find the target data layer object on the CDN?

The extension will receive an empty object and utag.js will automatically resume. No merging occurs.

What version of utag.js is required for this feature?

At a minimum, you must use version 4.38. The Hosted Data Layer extension is optimized for the latest version.

The following list describes offerings in each version:

  • v4.38 (and above)
    Displays the All Tags - Before Load Rules option
  • v4.42 (and above)
    Provides the ability to add a timeout period for utag.js.
  • v4.43
    Provides built-in error handling capability in the event that the CDN is running slow or has failed during merging.