Core concepts

What is Data layer (dataLayer)?

A structured JavaScript object on the page that holds the values (price, order ID, user state) tags read from, decoupling tracking from the site’s HTML.

Definition

The data layer (in GTM, the global `dataLayer` array) is a structured object the website pushes values into — purchase value, order ID, product list, logged-in state — that tags then read from.

It decouples the tracking from the page markup: instead of every tag scraping the DOM, the site declares the truth once in the data layer and all tags consume it consistently.

Why it matters for agencies

The data layer is where most "the tag fired but the value is undefined" bugs live. A pixel can report a healthy firing rate while passing an empty `value` for six weeks, quietly poisoning ROAS.

For an agency, an inconsistent or missing data layer is the root cause behind a surprising share of attribution discrepancies — and it’s invisible unless you inspect the actual payloads, not the dashboard counts.

Data layer in Phloz

Phloz models the data-layer dependency with the `uses_data_layer` edge type, so the map shows which tags rely on the data layer being populated — making a brittle, DOM-scraping setup visible rather than assumed-fine.

Frequently asked questions

Why not just let tags read the page directly?
DOM-scraping tags break every time the site’s markup changes — a redesign or a new theme silently kills them. A data layer is a stable contract the site maintains on purpose, so tracking survives front-end changes.
Who is responsible for the data layer?
The client’s developers populate it; the agency specifies what it must contain. Getting this contract written down at onboarding is the single biggest predictor of whether conversion tracking stays healthy.

Other tracking-infrastructure concepts agencies run into alongside this one.

Map your clients’ tracking with Phloz

14 days free · No credit card · Starter tier free forever