A dataLayer push looks like this: window.dataLayer.push({ event: "purchase", ecommerce: { transaction_id: "T-1234", value: 74.50, currency: "USD", items: [...] } }). GTM sees the event name, matches it against a trigger, and passes the nested values into whichever tags that trigger fires.
The dataLayer exists so tracking does not have to scrape the DOM. Reading an order total out of a CSS selector breaks the next time a designer touches the template; reading it from a dataLayer key survives redesigns, because the contract is the key name, not the markup.
Order matters. The dataLayer must be initialised before the GTM snippet runs, or the first pushes are lost. On e-commerce platforms this is why the "add the snippet after the dataLayer block" instruction is not optional.
See how your site handles this
TagEasy's free auditor checks any URL for Consent Mode v2 signals, PII in tracking, duplicate pixels, and 10 other tracking-quality faults. No signup.