Data Layer Design: The Decisions That Matter
The structured object on a page that supplies analytics and tag tools with consistent data.
On this page
Why does it matter?
Without a data layer, tags scrape the page and break whenever the markup changes.
What are the numbers?
- Structure a defined schema keeps values consistent
- Timing data must be available before tags fire
- Naming consistent naming across pages prevents fragmentation
- Documentation the schema needs a maintained specification
What should I do?
- Define and document a data layer schema
- Populate values server-side where possible
- Keep naming consistent across page types
- Version the specification
- Test the data layer in staging
What should I avoid?
Avoid:
- Tags reading values from the DOM
- Different names for the same value
- Undocumented data layer changes
- Values populated after tags fire
When should I get help?
Short answer Bring in help when analytics break after releases.
Where this comes from
- Google for Developers — Server-side tagging
- Google Analytics Help — Key events
The figures and practices above come from the sources listed.
Working on something like this?
We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.