Quick answer
In web analytics, a data layer is a JavaScript object or array on the page, such as window.dataLayer, where the site writes structured facts about the page, the visitor and their actions so tag managers and analytics tools can read them without scraping the HTML.
What is a data layer?
On a website, a data layer is a structured object where the site writes the facts that marketing and analytics tags need: what kind of page this is, which product, what the order was worth, whether the visitor is logged in. Tags read the data layer instead of digging values out of the HTML.
The term means other things elsewhere (the "data link layer" in networking, a data access layer in software). This page is about the website sense used with tag managers.
A sample purchase push
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'purchase',
order_id: 'A10234',
value: 128.50,
currency: 'USD',
items: [{ item_id: 'SKU-17', quantity: 2, price: 64.25 }]
});
Sample values. The checkout page pushes this once the order is confirmed. Every tag that cares about purchases (analytics, ad conversions) reads the same values.
Why it beats scraping the page
| Reading the page | Reading the data layer |
|---|---|
| Breaks when text or classes change | Stable contract between teams |
| Price may include currency symbols and formatting | Clean numbers and codes |
| Each tag parses the page its own way | One source, same values for every tool |
Naming rules
- One event name per action, in
snake_case, documented in your tracking plan. - Numbers as numbers, currencies as ISO codes.
- Push after the action succeeds, not on the button click.
- No personal data: no emails, names, phone numbers or free text.
Passing values to analytics
Analytics does not need a tag manager to use the same facts. On the confirmation page, read the values you need and send them as event properties, for example tapcub.track('purchase', { order_id, value, currency }); better still, send purchases from your server so blocked scripts do not lose them. Installing TapCub through a tag manager is covered in install with Google Tag Manager.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Technical Engineer
Focuses on tracking code, SDKs, and API integrations, with practical guidance on implementation checks and troubleshooting.