Glossary term

Data Layer

DMore terms under D

A data layer is a structured place for a website to make information available to other code. In analytics, it gives tools a consistent description of events such as a purchase, so reporting does not have to guess what happened from the page’s appearance.

An order-confirmation page might display “Thanks!” while the order value lives somewhere else in the application. A data layer can supply the event name, amount and currency directly. That is much sturdier than asking a tracking script to scrape a price from a heading that a designer could change tomorrow.

One purchase, named fields

A checkout receipt becomes structured information
Order confirmedCanvas tote
1 item$60.00
CurrencyUSD
Total $60.00
Order EXAMPLE-1042
Browser consoleIllustrative
A configured tag can read these fields.
Illustrative purchase data. Putting an event in the data layer does not itself send it to Analytics.
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: 'purchase',
  ecommerce: {
    transaction_id: 'EXAMPLE-1042',
    value: 60,
    currency: 'USD',
    items: [{ item_id: 'TOTE-01', item_name: 'Canvas tote', price: 60, quantity: 1 }]
  }
});

This Google Tag Manager-style example puts an event in a queue. A configured trigger can recognize purchase, and a tag can read ecommerce.value as 60. The transaction ID identifies the example order; names, email addresses and payment details do not belong in this object.

The agreement behind the fields is the important part. Does “purchase” mean payment completed, or just a click on “Pay”? Does value include tax and delivery? If teams use the same event name for different things, a tidy object can still produce misleading reports.

The data layer is not a tag manager or a consent system. Code decides what to place in it; tag configuration decides what to read and send. Those uses must respect the visitor’s choices.

Frequently asked questions

What is a data layer in Google Tag Manager?

It is the structured information that Tag Manager can read, usually through a JavaScript array named dataLayer. A page can push events and values into it; Tag Manager uses configured triggers, variables and tags to act on that information.

Is a data layer the same as Google Tag Manager?

No. The data layer holds information. Google Tag Manager is a separate system that can use that information to run tags. Other code can also read a data layer without using Tag Manager.

GA4 Custom Dimensions covers the implementation work.

Sources

← Browse Glossary: D