Shopify Google Tag Manager (GTM) Setup | Centralize GA4 and Ad Tags with dataLayer Best Practices
A guide to setting up Google Tag Manager (GTM) on Shopify. Covers when to use GTM over native integration, centralized management of GA4 and ad tags, how the dataLayer works with Liquid templates, checkout page limitations, and our service's GTM approach.
Introduction: What Is Google Tag Manager (GTM)?
Google Tag Manager (GTM) is a tag management system that lets you add, update, and remove tracking and marketing tags on your website without modifying code directly. GA4 tracking, Google Ads conversion tags, Facebook Pixel, and other third-party tags can all be managed from a single GTM interface.
Installing GTM on Shopify means you can change or add tracking configurations without touching your theme code each time.
Benefits of Using GTM on Shopify
- Centralized tag management: GA4, Google Ads, Meta Ads, and other tags managed in one place
- No code changes required for updates: Add or change tags without modifying the theme
- Flexible event tracking: Configure custom events such as specific button clicks, scroll depth, and form submissions
- Easy testing and debugging: Preview mode lets you verify behavior before publishing
Examples of Tags Managed via GTM
| Tag | Purpose |
|---|---|
| GA4 (Google Analytics) | Site-wide user behavior and conversion tracking |
| Google Ads conversion tag | Tracking purchases and inquiries from paid ads |
| Google Ads remarketing tag | Retargeting site visitors with ads |
| Facebook Pixel | Meta Ads conversion and audience tracking |
| Other third-party tools | Chat widgets, surveys, heatmaps, etc. |
Native Shopify Integration vs. GTM: When to Use Each
Shopify's native Google channel app provides basic GA4 tracking without code. GTM is the better choice in these situations:
- Managing multiple ad tags simultaneously (Google Ads, Meta Ads, etc.)
- Configuring custom GA4 events for specific interactions (button clicks, product page behavior)
- Full-order builds with custom themes where automatic tags may not fire correctly
- Anticipating frequent tag additions or changes in the future
For theme template builds tracking GA4 only, the native Shopify integration is often sufficient.
The dataLayer and How It Works on Shopify
What Is the dataLayer?
The dataLayer is a JavaScript object that passes information from your web page to GTM. It communicates data like which product was viewed, what was added to cart, and what the purchase total was — information that GTM then forwards to GA4 tags and ad tags. Using the dataLayer enables you to send detailed product attributes (category, brand, variant) to GA4's Ecommerce reports that standard tracking cannot capture.
Liquid Templates and the dataLayer
Shopify themes run on the Liquid template engine. To pass product data into the dataLayer, you embed Liquid variables — such as {{ product.title }} and {{ product.price | money_without_currency }} — inside JavaScript objects in your theme files. The dataLayer is initialized in the theme's head or section files, and GTM reads that data and forwards it to your configured tags.
Checkout Page Limitations and Custom Pixels
Shopify's checkout pages (cart, payment, order confirmation) are managed by Shopify itself, and Liquid editing is restricted on the Basic plan. This limits how much detail you can push into GTM from the checkout flow. Since 2023, Shopify has recommended its Custom Pixels feature for checkout-area tracking. Combining GTM with the Custom Pixels API is now the standard approach for measuring purchase completion events in detail. Shopify Plus expands what can be customized on the checkout page.
How Our Service Handles GTM
We choose between Shopify's native integration and GTM based on build type and the tags required.
- Theme template and theme customization builds: Native integration is the default for GA4 and Search Console only. GTM is available when additional tags such as Google Ads are needed.
- Full-order development: GTM is the standard due to the flexibility and extensibility it provides for tag management.
In all cases, GA4 will be tracking correctly at the time of launch. For pricing by build type, see Shopify Build Cost Guide: 3 Types Compared.
GTM's Relationship with GA4 and Search Console
GTM is the delivery mechanism — the measurement itself is handled by GA4, and search performance is managed through Search Console.
- GA4: Delivered via GTM or Shopify's native channel. See Shopify Google Analytics (GA4) Setup
- Search Console: Ownership verification via GTM is possible, though GA4-based verification is more common. See Shopify Search Console Setup
Summary
- GTM is a tag management system for centralizing GA4, ad tags, and other tracking
- GTM is the right choice for multiple tags, custom events, and full-order builds
- The dataLayer connects Liquid templates to GTM, but checkout pages have plan-based restrictions
- Our service selects between native integration and GTM based on build type
- GTM handles tag delivery; GA4 and Search Console handle measurement and SEO management
FAQ
Yes, GTM works on all Shopify plans — Basic, Shopify, Advanced, and Plus. You install it by inserting the GTM snippet into the head element of your Shopify theme.
Related articles
Shopify Search Console Setup | What It Does, Rich Results, Costs, and How It Differs from Google Analytics
Shopify developmentA guide to connecting Shopify with Google Search Console. Covers search performance monitoring, index management, Core Web Vitals, rich results, mobile usability, what our service includes in the build cost, and how it differs from Google Analytics.
11mm編集部Shopify Google Analytics (GA4) Setup | What It Tracks, Exploration Reports, Costs, and How It Differs from Search Console
Shopify developmentA guide to connecting Shopify with Google Analytics (GA4). Covers what GA4 measures, exploration reports, user properties and audiences, how the integration works, what our service includes in the build cost, and how GA4 differs from Search Console.
11mm編集部Shopify EC Site Monthly Maintenance Costs and Services | Light vs Standard Plan
Shopify developmentAlthough Shopify is a SaaS platform that requires no server management, ongoing tasks such as theme updates, app compatibility checks, minor fixes, and regular SEO monitoring still arise after launch. This guide explains that the Light plan is fixed at ¥30,000/month and the Standard plan is based on ¥60,000/month, with extra fees only when work exceeds the defined scope.
11mm編集部How to Increase Repeat Purchases on Shopify with Klaviyo | F2 Conversion and LTV Email Automation
Shopify developmentWhether a first-time buyer makes a second purchase (F2 conversion) is one of the biggest levers on your EC site's revenue. Unlike post-shipment step emails, the Klaviyo repurchase flow detects customers who haven't bought again despite enough time having passed, and automatically delivers a discount coupon around their churn date — at a fraction of web advertising costs.
11mm編集部