Skip to content

Definition

Data layer (dataLayer)

A JavaScript array that the site pushes events and values into so Google Tag Manager and gtag.js can read them, instead of scraping the page.

The data layer is an object Google Tag Manager and gtag.js use to pass information to tags. The site sends values with dataLayer.push({...}); adding an event key, such as dataLayer.push({'event': 'generate_lead'}), lets a Custom Event trigger in Tag Manager fire tags on it.

Google recommends declaring window.dataLayer = window.dataLayer || []; as high in the page as possible, and placing any values needed at page load above the container snippet. Pushing a key that already exists overwrites its value.

The classic mistakes are reassigning it with dataLayer = [...], which throws away what was already there, and casing: datalayer.push is a different variable and silently does nothing. A redesign that renames events or drops pushes is one of the most common reasons tracking stops after a site launch, so agree the event names and parameters with the developers in writing.

Related terms

Server-side tagging (sGTM)
Running a Google Tag Manager server container on infrastructure you control, so the browser sends data to your server and your server forwards it to vendors.
Consent Mode v2 (ad_user_data, ad_personalization)
Google's API for passing a visitor's consent choices to Google tags, with v2 adding ad_user_data and ad_personalization alongside ad_storage and analytics_storage.
Enhanced conversions
A Google Ads feature that supplements conversion tags with SHA256-hashed first-party data, such as email or phone, to match conversions to signed-in Google accounts.
Key event (GA4)
An event you mark in GA4 as important to the business, such as generate_lead; GA4 now reserves the word conversion for what is used in Google Ads.

Sources

Checked against the official documentation in November 2026. Platforms change; check the source for current details.

All glossary terms

Got an account that doesn't add up?

Send us one account. We review it for free and send a short video of what's working and what isn't.