Site icon Vify shopify app

Google Tag Manager for Shopify: How to Install and Set It Up Correctly

Setting up Google Tag Manager for Shopify correctly

Google Tag Manager for Shopify looks simple until the tracking setup reaches checkout. A few misplaced tags can leave important purchase data missing, while an existing Google & YouTube integration can cause the same order to be counted twice. Shopify’s checkout restrictions and sandboxed tracking environment make GTM setup different from a standard website. This guide explains how to install Google Tag Manager on Shopify correctly, connect it with GA4, choose the right setup method, and avoid common tracking issues that can affect your data.

How Google Tag Manager works in Shopify

Google Tag Manager (GTM) is a free container for managing tracking tags such as GA4, Google Ads, Meta, TikTok, and other marketing tools. Instead of editing store code whenever a new tracking script is needed, everything can be managed through one interface.

GTM uses three core components:

On a standard website, GTM can monitor the page directly. Shopify uses a different system. Shopify’s pixel manager is available under Customer events in the admin. Scripts added through this system run inside a sandbox, which restricts third-party code from interfering with the storefront or checkout.

In practice, Shopify sends information about what happened, such as a product view, cart addition, or completed checkout. GTM then determines which tags should fire based on that event.

This is an important part of any Google Tag Manager Shopify setup because pixels loaded through GTM still operate inside Shopify’s sandbox. The sandbox therefore affects what the tags can access and how certain events need to be handled.

GTM vs. Google & YouTube app

Before starting a Shopify Tag Manager setup, it is worth checking whether GTM is actually necessary.

Shopify’s Google & YouTube app already connects a store with Google Analytics and Google Ads without requiring a separate tag container. The more useful question is what the native integration does not cover.

Google & YouTube appGoogle Tag Manager in Shopify
Setup effortConnect a Google accountCreate a container, add pixel code, build tags and triggers
Events sentA fixed set: page_view, view_item, add_to_cart, begin_checkout, purchase, plus four more added August 17, 2026Any event created in GTM, including custom events
Data controlLimited control over included dataFull control over parameters and tag firing
Other platformsNot its main purposeMeta, TikTok, Pinterest, and other platforms can run through one container
MaintenanceGoogle maintains the integrationStore teams maintain tags, triggers, and tests

For basic GA4 and Google Ads tracking, the Google & YouTube app may provide everything needed. GTM becomes more useful when a store needs custom events, several advertising platforms, or greater control over the data sent to each platform.

Common examples include form submissions, button clicks, subscription actions, and custom conversion events.

3 ways to install Google Tag Manager for Shopify

There are three practical methods to install Google Tag Manager on Shopify. Each one has different capabilities.

Custom pixeltheme.liquidShopify app
Where it runsStorefront, checkout, Thank you, Order statusStorefront pages onlyDepends on the app
Checkout eventsYesNoYes
Technical skillComfortable with JavaScriptBasic theme editingLow
CostFreeFreePaid
Best forStores that need proper GTM coverageLegacy or storefront-only setupsNon-technical store owners

Shopify’s Help Center states that pixels can load on the storefront, checkout, Thank you page, and Order status page. That makes the custom pixel method the most important option to understand for a complete tracking setup.

Method 1: Install Google Tag Manager on Shopify as a Custom Pixel

This is the method Shopify documents for using GTM as a custom pixel.

There is one important limitation to understand first. Shopify considers custom pixels an advanced feature that requires JavaScript knowledge and states that Shopify does not support adding and using them. Consent, compliance, testing, and troubleshooting therefore remain the store’s responsibility.

Before starting

  1. Create or open a Google Tag Manager account.
  2. Copy the GTM Container ID, which starts with GTM-.
  3. Consider whether an existing Shopify app can handle the tracking requirement. Shopify recommends reviewing App Store options for stability, security, and performance before using custom code.
  4. Identify the Shopify events that need to reach GTM.

Step-by-step setup

  1. Open Google Tag Manager and go to Admin → Install Google Tag Manager.
  2. Copy the code block intended for the <head> section.
  3. Remove the HTML tags around the code, including the <script></script> wrapper. Shopify’s pixel environment does not accept HTML.
  4. In Shopify admin, go to Settings → Customer events.
  5. Add a new custom pixel and give it a clear name, such as GTM.
  6. Paste the JavaScript into the custom pixel.
  7. Add analytics.subscribe(...) calls for the Shopify events that need to be sent to the GTM dataLayer.
  8. Set the required consent permissions.
  9. Save and connect the pixel.
  10. Return to GTM and create the required tags, triggers, and variables.
  11. Test the setup before publishing the container.

Common mistakes with a custom pixel

Adding the noscript snippet

Shopify’s documented process only calls for the head code block. The standard website installation includes a noscript snippet, but that does not belong in this Shopify custom pixel setup.

Copying the sample consent settings without reviewing them

Shopify’s example pixel sets Google Consent Mode v2 signals to granted. Shopify also warns that these settings may not match privacy requirements in every region.

The example should therefore be treated as a starting point rather than a complete compliance solution.

Subscribing to events without creating tags

Sending events into the dataLayer is only one part of the setup. Shopify’s tutorial requires at least one tag and trigger in GTM before data can be transferred to the destination platform.

Method 2: Add Google Tag Manager through theme.liquid

The classic installation method still works for storefront pages.

Go to Online Store → Themes → Edit code, then open layout/theme.liquid.

Google’s installation guidance places the first GTM snippet immediately after the opening <head> tag and the second noscript iframe immediately after the opening <body> tag.

This approach has two important limitations:

It only covers the storefront

theme.liquid controls the storefront layout. Checkout and Thank you page events need to go through Shopify’s pixel system.

That means a theme-based installation alone cannot provide complete purchase tracking.

Avoid loading the same container twice

If a GTM container is already installed in theme.liquid and the same container ID is added again through a custom pixel, tags can fire more than once.

Each container needs a single installation point.

If event data was previously pushed with dataLayer.push() in theme files, Shopify’s guidance is to replace those calls with Shopify.analytics.publish(). The custom pixel can then subscribe to the custom event.

Method 3: Use a Shopify Tag Manager app

For stores that do not want to manage JavaScript manually, a Shopify app can simplify the setup.

One example is Anowave Google Tag Manager GA4, which describes automated GTM installation through the Web Pixels API and also offers optional server-side tracking.

The app listing also shows permissions for customer data such as names, emails, and addresses, along with web pixel and script tag permissions.

Those permissions are relevant to any tracking implementation. Before installation, the requested access should be checked against the store’s privacy policy and data-protection requirements.

Test and debug Shopify Tag Manager setup

Testing a Shopify GTM implementation is different from testing a standard website because regular debugging tools do not always see inside the Shopify sandbox.

Shopify recommends using Shopify Pixel Helper to confirm that events reach the sandbox without errors.

Google Tag Assistant can still help identify Google tags that load on the page. However, Shopify states that Tag Assistant’s Troubleshoot tag feature is not compatible with custom pixels and cannot detect Google tags inside a custom pixel or other pixels loaded through GTM.

SymptomLikely causeFix
No data reaches GTMNo tag or trigger configuredCreate at least one trigger and tag
Tag Assistant shows nothingCustom pixel incompatibilityUse Shopify Pixel Helper and GA4 DebugView
Trigger never firesEvent name does not matchMatch the event name exactly
GA4 page URLs look unusualSandbox URL informationTurn off automatic page tracking and send page_viewed manually
Purchases are counted twiceApp and GTM both send the event, or the container is installed twiceRemove one source
Fewer EU/UK events appearVisitors declined consentReview consent settings
Scroll or outbound clicks are missingSandbox cannot detect the interactionPublish custom events from theme code

Reports from Shopify community discussions and third-party guides also describe GTM initialization problems and missing events in GTM Preview when custom pixels are involved.

These reports are anecdotal rather than official guidance. The more reliable approach is to validate events with Shopify Pixel Helper, the browser network tab, and GA4 DebugView instead of depending on GTM Preview alone.

FAQs

Can I use Google Tag Manager with Shopify?

Yes. Shopify’s Help Center documents using GTM as a custom pixel, and you can also load it through theme.liquidor a Shopify app. The custom pixel route is the one that covers storefront, checkout, Thank you, and Order status pages.

Do I need Shopify Plus to use Google Tag Manager?

No. Custom pixels are managed under Customer events in the admin. Plus stores simply faced earlier deadlines for retiring checkout.liquidon checkout-related pages.

Is the Google & YouTube app enough, or do I need GTM?

For basic GA4 and Google Ads tracking, the app can be enough. GTM becomes worth it when you need custom events, multiple ad platforms, or control over the parameters you send.

Why aren’t my events showing in GTM Preview mode?

Checkout-related events run in Shopify’s sandbox, so GTM’s usual debugging tools may not show them. Verify with Shopify Pixel Helper, your browser’s network tab, and GA4 DebugView, and confirm a trigger and tag exist in GTM.

Will Google Tag Manager slow down my Shopify store?

It can. Shopify warns that the more scripts you run, the slower your store can get, and broken pixel code can cause slow or failed loads. Keep your container lean, remove unused tags, and avoid installing GTM in more than one place.

Conclusion

Google Tag Manager for Shopify becomes useful when the native Google & YouTube app does not provide enough control over events, parameters, or marketing platforms. The installation method matters just as much as the tags themselves. A custom pixel provides the coverage needed for checkout and purchase events, while a clear event ownership strategy helps prevent duplicate tracking. Careful testing with Shopify Pixel Helper and GA4 DebugView also helps keep the data reliable as Shopify and Google continue to change how tracking works.

For Shopify stores looking for a professional invoice solution that’s easy to customize without any coding, Vify Shopify Order Printer app is worth considering. Try it for free today and see how it fits your store’s needs.

Exit mobile version