The data layer: what it is and why it simplifies measurement

Abstract orange illustration on a dark background: a database. Article topic: “The data layer: what it is and why it simplifies measurement”
In brief

The data layer is a structure on the site that organises, in a standard way, the information you want to measure: product, value, user (if consented), page, action. Instead of each tag grabbing data from the screen, it reads from there. It makes measurement more robust, consistent and easy to maintain.

The essentials in a definition

The data layer is a structure on the site where information about the page, the user and events (products, prices, orders) is published in an organised way. Tag Manager and tags read this layer, instead of depending on visual elements that change. It simplifies measurement because it separates data from how it is used. Consult the developer documentation and define consistent events.

What it is

A data layer is an object on the site, filled by the platform or code, that describes what is happening: which product was viewed, the cart value, which checkout step, what type of page. Tags read those values and send them to measurement tools.

Data no longer depend on the site’s look.

Why it simplifies

If measurement picks up data by reading the screen text or page structure, any design change can break it without warning. With a data layer, design can change and measurement carries on. It lets you use the same data in several tools, reduces duplication and eases validation.

It separates content from form.

Illustrative diagram with 4 numbered steps joined by an orange line, the last one marked as done. It represents: The data layer simplifies measurement

The data layer simplifies measurement

  1. Define a documented schema
  2. Include page, product, commerce and leads
  3. Respect consent
  4. Test on all journeys

What to include

Page type and language. Product information (identifier, name, category, price). Commerce events (view, add to cart, checkout start, purchase with transaction ID, value, currency, tax, shipping). Lead events (form submitted, type). Consent state. Avoid unnecessary personal data.

Privacy by design.

Large orange quotation marks on a dark background with abstract lines of text, illustrating the quote: “With a data layer, the site can change its face without breaking measurement.”
With a data layer, the site can change its face without breaking measurement.

Implement with care

Define a documented schema, with consistent names. Ask the development team or use commerce platform extensions. Test on all journeys and devices. Validate that values match reality (prices, currency, quantity). Update when the site changes and record changes.

A good data layer is a contract between teams.

Decision table

Without a data layerWith a data layerAdvantage
Tags read the screenTags read structured dataFewer errors when design changes
Each tag with its own logicCommon data logicConsistency
Changes require redoing tagsChanges on the site, tags intactSimple maintenance
Hard to documentDocumented schemaCollaboration

Common mistakes to avoid

  • A data layer without documentation. Nobody knows what exists.
  • Inconsistent data across pages. Measurement errors.
  • Including personal data unnecessarily. Privacy risk.

How to measure the result

Track measurement errors after site changes and the time to implement new events.

Limits and exceptions

Implementing a data layer requires initial work and coordination with development. Commerce platforms may have predefined implementations with limits. Review and validate after site changes.

Illustrative example

Illustrative example: a store defines a data layer with product, price and order information, documents the schema and aligns with the development team. Tags start to read from it. When the design changes, measurement stays intact.

In practice: checkpoints

Ask the development team for a document with the data layer schema, examples of each event and the pages where it occurs, and keep it with the code. Define a process for requesting new fields and for reviewing existing ones. After each release, verify that values match reality, for example prices and currencies. Add automatic tests where possible, so that a change that breaks the layer is caught before it reaches production. Use the same field names across platforms, version the schema and mark deprecated fields clearly. Involve marketing, analytics and development in a short regular meeting, since the data layer is a shared contract. Check that no personal data enters the layer without a clear need and legal basis, and that consent state is available to the tags that depend on it.

Frequently asked questions

Do I need a data layer?

It helps a lot, especially in shops and sites that change often.

Can I include personal data?

Avoid; include only what is necessary and with legal basis.

Who implements it?

Normally development, guided by whoever manages measurement.

Do I need a developer?

Usually yes, to implement the layer on the site.

Which data should I include?

What is necessary to measure and optimise, without unnecessary personal data.

Summary to quote

Use a documented data layer, with structured information and no unnecessary personal data, to make measurement stable and easy to maintain.

Sources and recommended reading

Last editorial review: October 2026. Informational content; always confirm current conditions in the official sources before deciding.

Keep reading

Contacto rápido

Quer falar sobre as suas campanhas?

Deixe uma nota curta. Respondo em 1 dia útil.