Shopify4 min read1 view

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.

Watch on YouTube

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.

Ask an assistant

ChatGPTClaudePerplexity

FREE CALL

30 MIN

Meta stopped counting your leads? Get them counted again.

  1. Pick a time
  2. Check your Meta account with Hassan
  3. 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.

Book my free recovery callFree 30-minute call with Hassan.

Not ready to talk? Run a free check

Can 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.

What 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.

How 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

  1. Open the intended container.
  2. Record its GTM- ID.
  3. If you are creating one, follow Google's account and container setup.
  4. 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.

How 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

  1. In GTM, open the snippets from the container ID in Workspace, as Google's install instructionssupport.google.com describe.
  2. In Shopify, follow the theme code editor instructionshelp.shopify.com on the test copy.
  3. 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.

  1. Put the first snippet high in <head>.
  2. Put the second immediately after the opening <body>.
  3. 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

  1. Open the duplicated theme's preview.
  2. Connect it using GTM Previewsupport.google.com.
  3. 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.

Does 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.

When 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.

What 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.

What 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
  1. 1Shopify recommends checking available apps before building a custom pixel↩
  2. 2Shopify has sunset checkout.liquid and Additional Scripts on Thank you and Order status pages↩
  3. 3Google's installation guide↩
  4. 4Shopify recommends duplicating a theme before code changes↩
  5. 5Google's setup guide↩
  6. 6GTM Preview↩