How to install Google Tag Manager on Shopify
Install GTM on a Shopify test theme, verify the container and choose a separate Customer events setup for checkout tracking.
Shahzada Ali Hassan, founder of Crisperchecked against 6 sources
The short answer
Install Google Tag Manager in a Shopify theme for storefront tagging, and plan checkout tracking separately through Customer events. Shopify has sunset checkout.liquid and Additional Scripts on Thank you and Order status pagesshopify.dev. This guide helps store owners test a theme installation without mistaking it for a complete purchase setup.
- Use a test theme and test GTM container for this walkthrough.
- Theme snippets and Customer events pixels are different installation paths.
- Shopify recommends checking available apps before building a custom pixelhelp.shopify.com.
- Installation guidance checked against Google and Shopify documentation on 25 October 2026.
FREE CALL
30 MINMeta stopped counting your leads? Get them counted again.
- Pick a time
Check your Meta account with Hassan- See what to do next
On a free 30-minute call, Hassan checks your Meta account with you and shows you what to do next.
Not ready to talk? Run a free check
01Can I install Google Tag Manager on Shopify?
Yes. A theme can carry the web-container snippets from Google's installation guidesupport.google.com; checkout events need the separate path described below. A container is the collection of tags and rules you manage in GTM.
The video shows the older theme-only walkthrough. The written guide keeps the storefront method and adds current checkout boundaries and testing steps.
02What do I need before adding GTM to Shopify?
Have access to the intended Google Tag Manager account and permission to edit a Shopify test theme. Record existing analytics apps, custom pixels and theme snippets before adding a second installation.
- A Google account with access to the intended test web container.
- A Shopify store and a duplicated theme for this walkthrough.
- A list of the tags and events you need, including which ones belong to checkout.
03How do I choose the right GTM container?
Use the container intended for the website, or create a separate test container for this exercise. Google's setup guidesupport.google.com calls for an account for the company and a container for each website or app.
1. Confirm the test container ID
- Open the intended container.
- Record its
GTM-ID. - If you are creating one, follow Google's account and container setup.
- For a new container, choose Web for this website exercise.
Done when the name, website and ID all identify the test setup you intend to install.
04How do I add GTM to a Shopify theme?
Copy the container's two installation snippets into the duplicated theme, then test that theme. Keep the snippet contents intact and use the same container ID in both.
2. Open the installation snippets and theme file
- In GTM, open the snippets from the container ID in Workspace, as Google's install instructionssupport.google.com describe.
- In Shopify, follow the theme code editor instructionshelp.shopify.com on the test copy.
- Open
layout/theme.liquid.
Done when the file shows the opening head and body tags.
3. Insert the two snippets
Place the snippets where Google specifiessupport.google.com.
- Put the first snippet high in
<head>. - Put the second immediately after the opening
<body>. - Save the test theme file.
Done when both snippets are present with the intended container ID and the theme saves without an error.
4. Verify the test storefront
- Open the duplicated theme's preview.
- Connect it using GTM Previewsupport.google.com.
- Check the tags you meant to run in Tag Assistant's event timeline.
Done when Tag Assistant connects to that storefront preview and identifies the intended test container.
05Does installing GTM in the theme track Shopify checkout?
Do not treat a theme installation as a checkout implementation. Shopify's current GTM tutorialhelp.shopify.com loads GTM in a custom pixel and subscribes to Customer events; the checkout path uses that event data.
The old checkout route is retired: Shopify marks checkout.liquid and Additional Scripts as sunsetshopify.dev. For purchases, follow the Shopify Meta Purchase guide, which maps Customer events to the purchase tag.
06When should I avoid a manual GTM installation?
If an existing app already handles the events you need, inspect that setup before introducing another sender. This walkthrough stops at a tested storefront installation; checkout and purchase mapping are separate work.
- Adding the same container again makes the installation harder to diagnose. Inventory existing snippets and integrations first.
- Using a theme preview result as a checkout test leaves checkout untested. Use the Customer events procedure and Pixel Helper for that path.
- Copying HTML script tags into the pixel editor mixes installation formats. Follow Shopify's custom-pixel instructions for its JavaScript-only code.
07What should I do after GTM connects?
Write down the container ID, tested theme and tags observed in Preview. Hand those checks to the store owner with the event plan before making a live installation change.
08What changed in this guide
- 25 October 2026: Corrected the one-container-per-business claim to Google's website/app guidance. Separated theme installation from current Customer events checkout tracking and documented legacy checkout retirement. Added a test-theme procedure and the correct storefront versus custom-pixel debugging tools.
Sources
6 sources
- 1Shopify recommends checking available apps before building a custom pixelhelp.shopify.com↩
- 2Shopify has sunset checkout.liquid and Additional Scripts on Thank you and Order status pagesshopify.dev↩
- 3Google's installation guidesupport.google.com↩
- 4Shopify recommends duplicating a theme before code changeshelp.shopify.com↩
- 5Google's setup guidesupport.google.com↩
- 6GTM Previewsupport.google.com↩

