Analytics Lab / Data layer

Unified data layer

A unified data layer defines each event once, in a vendor-neutral schema. Tag Manager or a mapping script translates that event into GA4, Adobe Analytics, Meta, and other vendor calls. This page uses GA4 recommended event names and the GA4 items array as the canonical shape. Use the controls to see what each interaction pushes to window.dataLayer.

Schema
unified-data-layer/v2
Namespace
lab.analytics.udl

Base context

Session, user, and page objects are set once per page load. Every event includes them, so each vendor mapping reads the same values.

Session

{
  "id": "session-0042",
  "timestamp": "2024-01-01T12:00:00Z",
  "source": "organic"
}

User

{
  "auth_state": "anonymous",
  "persona": "analyst",
  "account_tier": "free"
}

Page

{
  "template": "lab-sandbox",
  "section": "analytics",
  "language": "en-US"
}

Tracked interactions

Buttons, links, and forms declare their event in data-udl-* attributes. A script reads the attributes and pushes one event per interaction.

Navigation and search

Calls to action, help links, and site search.

Read: Installing the tracking snippet

Video and downloads

Video start and progress, and file downloads.

Download pricing sheet (PDF)

Ecommerce

Add to cart, checkout, and purchase share one items array. Each ecommerce push is preceded by { ecommerce: null } to clear the previous event's items.

Feedback, consent, and errors

Content ratings, consent changes, and client-side errors.

Vendor mapping

Each canonical event maps to one call per vendor. Keep the mapping in Tag Manager or in one script, not in page code.

Data layer event GA4 Adobe Analytics Meta Pixel
page_viewpage_views.t()PageView
searchsearch (search_term)s.tl() with an internal search eVarSearch (search_string)
video_start, video_progressvideo_start, video_progressMedia Analytics trackPlay, milestonesCustom event
file_downloadfile_downloads.tl(this, 'd', name)Not sent
add_to_cartadd_to_cart (items)scAdd with s.productsAddToCart (content_ids, value, currency)
begin_checkoutbegin_checkoutscCheckoutInitiateCheckout
purchasepurchase (transaction_id)purchase with s.purchaseIDPurchase (value, currency)
consent_updategtag('consent', 'update')Opt-in servicefbq('consent', 'grant' or 'revoke')

Initialization snippet

Create the data layer and push the base context before the tag manager loads and before any interaction handlers run.

<script>
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    schema: 'unified-data-layer/v2',
    session: {/* ... */},
    user: {/* ... */},
    page: {/* ... */}
  });
</script>