Install on Shopify
Shopify needs two pieces:
- Theme code — the GTM snippet in
theme.liquid - Customer Events Pixel — for checkout events that fire on Shopify's checkout subdomain
Skip the Customer Events Pixel only if you don't need purchase / checkout tracking.
Step 1 — Paste GTM into theme.liquid
- In Shopify Admin, go to Online Store → Themes
- Find your active theme → Actions → Edit code
- Under Layout, open
theme.liquid - Find the
<head>tag (usually near the top) - Paste the GTM head snippet (shown in the wizard's Shopify Install tab) immediately after
<head> - Find the
<body>tag - Paste the GTM noscript snippet immediately after
<body> - Click Save
Step 2 — Add the Customer Events Pixel
Shopify's checkout runs on a separate domain (checkout.shopify.com) where theme code doesn't execute. To fire add_to_cart,purchase, and similar events from the checkout, you need a Customer Events Pixel.
- In Shopify Admin, go to Settings → Customer events
- Click Add custom pixel
- Give it a name like "TagEasy DataLayer Pixel"
- Paste the JS shown in the wizard's Shopify Install tab → Step 3 card
- Click Save, then Connect when prompted
- Under Customer privacy, set the permissions appropriate to your jurisdiction
That pixel listens to Shopify's checkout events (product_viewed,product_added_to_cart, checkout_completed) and pushes equivalent dataLayer events back to your storefront so GTM picks them up.
Step 3 — Verify with GTM Preview
- In GTM, click Preview (top-right)
- Enter your storefront URL
- Walk through the buyer journey: view product → add to cart → checkout → completed purchase
- Each step should fire the corresponding tag in GTM's Debug panel
Pre-built event templates for Shopify
These are already provisioned for you when you pick "e-commerce funnel" in the wizard:
shopify:ga4:view_itemshopify:ga4:add_to_cartshopify:ga4:begin_checkoutshopify:ga4:purchase(requires the Customer Events Pixel)
Common gotchas
- Theme app extensions — Some themes use app blocks for header/footer code. If
theme.liquiddoesn't take, look for an app extension and add the snippet there. - Online Store 2.0 — fully supported; same install path.
- Shopify Plus checkout extensibility — uses the same Customer Events Pixel API. No additional config.
- Headless storefront — skip the theme.liquid step; install GTM directly in your top-level layout. The Customer Events Pixel still applies if you use Shopify checkout.