Glossary term
Data Layer
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
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.

