GTM works with three building blocks. Tags are the snippets that send data: a GA4 event, a Meta purchase, a TikTok pixel. Triggers decide when tags fire, for example on a purchase event in the data layer. Variables hold the values tags need, such as order ID, revenue or product IDs. Everything lives in a container with version history, so changes can be previewed, tested and rolled back.
There are two flavors. Web GTM runs in the shopper’s browser. Server-side GTM runs on your own cloud server, receives events from the site and forwards them to platforms. That gives more control over data, better resilience to browser restrictions and a natural place to enforce consent.
Why it matters for eCommerce
Many tracking problems come from tags added ad hoc by apps, agencies and developers over the years. A well-organized container makes tracking auditable, reduces duplicate conversions and keeps ad platforms fed with clean data that improves bidding.
How it works in practice
- Base tags on the data layer, not on page text or CSS selectors.
- Use a consistent naming convention for tags, triggers and variables.
- Connect your CMP and Google Consent Mode so tags respect each visitor’s choices.
- Use preview mode and workspaces for every change, and document what each tag does.
Common mistakes
- Too many people with publish rights and no change log.
- Old pixels from past agencies still firing.
- Installing GTM on Shopify and expecting it to track checkout without Customer Events.