You can no longer add Google Tag Manager to Shopify’s checkout by editing checkout.liquid or pasting code into “Additional scripts”. Shopify has moved checkout, thank-you and order status pages to Checkout Extensibility, so there are now three realistic options: use the Google & YouTube app for GA4 and Google Ads, run GTM inside a Customer Events custom pixel, or add GTM to theme.liquid for storefront-only tracking.
For most stores, the Google & YouTube app plus GTM in the theme for extra storefront events is the simplest reliable set-up. A custom pixel gives you GTM-style control over checkout events, but it runs in a sandbox with real limitations. This guide explains each option and its trade-offs.
Your options at a glance
| Option | Tracks checkout and purchases? | Effort | Main trade-offs |
|---|---|---|---|
| Google & YouTube app (Google tag) | Yes, standard ecommerce events | Low | Limited customisation; you can’t add arbitrary tags |
| GTM in a Customer Events custom pixel | Yes, via Shopify’s customer events | Medium–high | Sandboxed iframe, no normal GTM Preview, no DOM access, needs developer-level testing |
GTM in theme.liquid |
No, storefront pages only | Low | Doesn’t load on checkout or thank-you pages; theme updates can remove it |
Legacy checkout.liquid / Additional scripts |
Not available going forward | N/A | Deprecated; being switched off as stores are upgraded |
Option 1: Google & YouTube app (recommended starting point)
The Google & YouTube app connects your store to Google Merchant Center, Google Ads and GA4 and installs the Google tag for you. It sends standard ecommerce events (such as page views, add to cart, begin checkout and purchase) from storefront and checkout using Shopify’s approved pixel framework, so it keeps working after checkout upgrades.
- Pros: official, maintained by Google and Shopify, survives theme changes, covers purchases.
- Cons: you can’t add custom tags or change event logic, and you should avoid also sending the same purchase event from GTM, or GA4 and Google Ads will double count.
Option 2: GTM inside a Customer Events custom pixel
If you need GTM’s flexibility in checkout (for example, extra marketing tags or custom event parameters), Shopify’s custom pixels let you load GTM in Settings > Customer events > Add custom pixel. The pixel code loads the GTM container, subscribes to Shopify’s standard events (for example checkout_completed) and pushes them into the dataLayer, where your GTM triggers pick them up.
A simplified example of the pattern (replace GTM-XXXXXXX and extend for the events you need):
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');
analytics.subscribe('checkout_completed', (event) => {
const checkout = event.data.checkout;
window.dataLayer.push({
event: 'purchase',
ecommerce: {
transaction_id: checkout.order?.id,
value: checkout.totalPrice?.amount,
currency: checkout.currencyCode
}
});
});
Sandbox limitations to plan for
- Runs in a sandboxed iframe. Tags can’t read or change the page DOM, so click, scroll and element-visibility triggers won’t work as they do on a normal site.
- GTM Preview / Tag Assistant generally can’t connect to the sandbox, so you’ll test with GA4 DebugView, Google Ads conversion diagnostics, browser developer tools and Shopify’s pixel helper tools instead.
- Page URL and referrer variables may reflect the sandbox rather than the real page; pass the page location from the event’s context if you need it.
- Consent: custom pixels respect Shopify’s customer privacy settings, so events may not fire for visitors who decline tracking.
- Data is limited to what Shopify exposes in its standard events; there’s no access to arbitrary checkout fields.
Option 3: GTM in theme.liquid (storefront only)
Adding GTM to your theme still works for storefront pages (home, collection, product, cart, blog). It’s useful for things like button clicks, scroll depth or third-party tags on product pages, but it won’t load on checkout or thank-you pages, so it can’t track purchases on its own.
Step 1: Copy your GTM container code
In Google Tag Manager, click your container ID (GTM-XXXXXXX) at the top of the workspace to show the install snippets.

Step 2: Duplicate your theme and edit code
In Shopify admin go to Online Store > Themes. Use the three-dot menu on your live theme to Duplicate it as a backup, then choose Edit code.

Step 3: Add the snippets to theme.liquid
Open layout/theme.liquid. Paste the first snippet as high in the <head> as possible and the <noscript> snippet immediately after the opening <body> tag. If a page builder app uses its own layout files, add the code there too. Save.

Step 4: Test with Preview mode
In GTM click Preview, enter your store URL and click Connect. Browse a few storefront pages and confirm the container loads on each.


Remember to publish the container. If you switch or update your theme later, check the snippet is still there.
Which set-up should you choose?
- You just need GA4 and Google Ads purchase tracking: use the Google & YouTube app.
- You also want click or engagement tracking on product pages: add GTM to
theme.liquid, but don’t fire purchase tags from it. - You need custom checkout tags or parameters: use a custom pixel, and budget time for testing.
Whatever you choose, make sure each purchase is sent to each platform from one place only. Duplicate sources are a common reason for inflated conversions, covered in Google Ads showing conversions but no sales.
Frequently asked questions
Can I still use Additional scripts on the order status page?
Shopify is retiring Additional scripts and script tags on the thank-you and order status pages as stores are upgraded to Checkout Extensibility. Check the upgrade notice in your Shopify admin for your store’s timeline and move tracking to the app or a custom pixel before then.
Do I need Shopify Plus?
No. Custom pixels and the Google & YouTube app are available on standard plans. Plus adds extra checkout customisation, but it isn’t required for tracking.
My Google Ads purchases stopped recording after an upgrade. Why?
Usually because the old tag lived in checkout.liquid or Additional scripts. See Google Ads conversions not firing on Shopify for a step-by-step fix.
Shopify tracking is fiddly to get right. If you’d like help, our conversion tracking service sets up GA4, GTM and Google Ads for Shopify stores, and our Shopify team can handle the store side.
Jane James
Jane James is an experienced digital marketer focused on Google Ads, Meta Ads and social media. At Alpha Omega Digital she plans, builds and manages paid advertising campaigns and conversion tracking for Australian businesses, with an emphasis on measurable leads and sales rather than vanity metrics.