Available for projects & agency overflow · Quick reply, from the person who does the work

Installing Google Tag Manager on a Shopify store

On Shopify, installing the Google Tag Manager container in theme.liquid no longer covers the whole measurement. Since Shopify moved to its new checkout system, the payment step has to be handled separately through Custom Pixels, in Settings > Customer events.

Describe my issue Send a message

The situations I handle

  • GTM is installed in theme.liquid but no tag fires on the payment page
  • You’re not sure if the container is enough on its own or if a Custom Pixel is also needed
  • A tag used to work before a Shopify update and stopped reporting since
  • You’re migrating from another platform and assume one code location is enough, like elsewhere
  • You want to centralise GA4, Ads and Meta through GTM while still covering purchases

How I install GTM on Shopify

  1. Installing the container in theme.liquid

    I place both GTM code snippets (head and body) in theme.liquid, which covers the catalogue, product pages and cart.

  2. Assessing the payment page

    Since custom scripts were removed from the payment and confirmation pages, the code placed in theme.liquid no longer loads there: a second mechanism is needed.

  3. Creating a Custom Pixel

    In Settings > Customer events, I create a Custom Pixel that listens to Shopify events (order placed, add to cart). That pixel runs inside a sandboxed iframe with no access to the parent window, so it cannot push into the theme's window.dataLayer. I load a GTM instance inside the pixel itself, with its own data layer, and that instance fires the checkout-step tags.

  4. Matching the data layer across theme and pixel

    I match the variables (items, value, currency, transaction_id) between what theme.liquid sends and what the Custom Pixel sends, so both GTM instances, the theme's and the pixel's, report consistent data.

  5. End-to-end testing

    I place a full test order and check in GTM preview mode that tags fire correctly both on the catalogue and on the order confirmation.

A quirk specific to Shopify

On PrestaShop or WooCommerce, a single code location in the theme is usually enough to cover the whole purchase funnel, including order confirmation. On Shopify, that’s no longer the case since the move to checkout extensibility: Shopify removed the ability to add custom scripts to the payment and confirmation pages, with a 28 August 2025 deadline announced for phasing out legacy customisations.

In practice, a GTM container installed only in theme.liquid keeps covering the catalogue and cart, but loses all visibility on the payment step. That step needs handling separately, through a Custom Pixel in Settings > Customer events, or through the official sales channels depending on the end tool.

Since early 2025, Shopify has also automatically migrated old pixels not configured through the official channels into custom pixels, with Shopify itself flagging a risk of lost measurement while the migration is checked.

Related pages

Describe your need in one minute

A few targeted questions so I can reply with an estimate rather than another questionnaire.

outil
api
sens
frequence (facultatif)
Please provide an email or a phone number so I can get back to you.

Please provide an email or a phone number so I can get back to you.

Frequently asked questions

Is the GTM container in theme.liquid enough on Shopify?
No, not since the move to the new checkout system. theme.liquid covers the catalogue and cart, but no longer the payment page or order confirmation.
What is a Custom Pixel?
A Shopify feature, in Settings > Customer events, that listens to site events from a sandboxed environment and lets you send tracking data even on payment pages where the theme code no longer runs.
Why did my tag used to work and not any more?
Shopify stopped rendering custom scripts on the payment and confirmation pages, with a 28 August 2025 deadline announced. A tag installed only in theme.liquid stopped covering those pages from that point.
Does a pixel automatically migrated by Shopify still work?
Since early 2025, Shopify has automatically migrated old pixels not configured through the official channels, with a risk of lost measurement while the migration is checked. I always check this on older Shopify accounts.
Do I need consent before GTM fires tags on Shopify?
Tags fired by GTM, GA4 in particular, don’t meet the CNIL’s exemption criteria in their standard configuration and therefore, in principle, require the visitor’s prior consent, as on any other platform.