Technical
Data layer
Also called digital data object.
Data layer is a JavaScript object, often `window.dataLayer`, where a page publishes structured facts such as product id, price, and user state for tags to read. It separates what the page knows from how each tool wants to receive it.
How it is measured
Open the console and type `dataLayer`. You get an array of pushed objects in order, each with keys like `event: 'purchase'` and `value: 59.9`. A tag manager listens for pushes and fires tags by rule.
Check three things: the push happens before the tag that needs it, the types are stable (a number, not a string), and it fires once per action. Stepping through the array shows all three.
Worked example
A plugin on a WordPress store pushes an add-to-cart event with `price: '24.00'` as a string. The tag expects a number, and the revenue report shows zero for six days. Changing it to `price: 24.00` fixes new events but not the history.
On the thank-you page one theme pushes `purchase` before the cart clears and another after. On the second theme the array holds two purchase events for one order, and the order is counted twice until a guard on order id is added.
How it differs
A data layer holds the facts. A tag manager is the container that reads them and decides which tags to run. A page can have a data layer and no tag manager, in which case your own script reads it. The manager never decides what the page publishes.
Common errors
Pushing before the container loads. Renaming keys between releases. Overwriting the array with `dataLayer = []`. Putting emails or names in it. Pushing the same event again on every re-render. Mixing strings and numbers in one field.
In practice
Write a one-page spec of event names and fields, and check the console against it after each release. Keep values to plain data, no functions. Push personal fields only if the consent state allows it.