Create and install a GTM container
Create a new container in GTM, then add the <head>
and <body>
snippets to theme.liquid
. Avoid duplicate tags from apps.
Docs: Install GTM, theme.liquid.
Data layer basics
Expose page_type
, product details, and order data when possible. Keep a stable schema and avoid renaming keys mid‑campaigns.
Consider a dataLayer push on key events (view_item, add_to_cart, purchase).
Events and preview mode
Use GTM preview to validate triggers, variables, and tag sequencing. Ensure consent checks run before marketing tags.
Label events clearly so your team can debug fast.
Versioning and rollback
Name versions clearly (e.g., 2025‑03‑GAds‑Signup‑Fix) and keep a rollback note. Export container snapshots before large edits.
Frequently Asked Questions
Where should GTM code go?
In theme.liquid: head and body. Follow GTM placement guidance.
Does GTM slow my site?
Use async tags, trigger conditions, and consent checks.