On this page
The cleanest Shopify Google Analytics setup in 2026 uses one route only: the Google & YouTube app for a fast, standard GA4 install, or Google Tag Manager loaded inside a Shopify custom pixel when you need full control. Since Shopify’s checkout upgrade, checkout and purchase tracking must come from Shopify’s customer events, not from code pasted into the theme or the old Additional scripts box.
What You Need Before You Start
Have these ready before you touch the store. Most failed setups trace back to a missing permission or old code nobody removed.
- Shopify admin access with permission to manage apps and Settings > Customer events.
- A GA4 property and web data stream, with at least Editor access, and its Measurement ID (G-XXXXXXX).
- A Google Tag Manager web container (GTM-XXXXXXX) if you plan to use GTM.
- A list of every place tracking code lives today: theme.liquid, apps, old Additional scripts, other pixels.
- Your consent banner or Shopify’s customer privacy settings, so you know which visitors may be tracked.
- A way to place a test order (a discount code for 100% off or a test payment method).
Should You Use the Google & YouTube App or Google Tag Manager for GA4?
Use the Google & YouTube app if you want standard ecommerce reports with the least maintenance. Use GTM in a custom pixel if you need custom events, extra parameters, or one container that also feeds other platforms.
Shopify’s own GTM page recommends the built-in Google integration for ecommerce data and warns that adding Google Analytics through GTM on top of it can cause duplicate tracking. Google’s Shopify setup guide says the app now captures events such as view_item_list, view_cart, remove_from_cart and add_shipping_info. That covers most small stores well.
| Need | Google & YouTube app | GTM custom pixel |
| Fast standard GA4 setup | Best fit | More work |
| Custom events and parameters | Limited | Best fit |
| Other platforms in one container | No | Yes |
| Support from Shopify | Supported app | Custom pixels are unsupported |
| Ongoing upkeep | Low | You own fixes and updates |
Some examples by store type:
- A single-brand apparel store running Google Shopping and Performance Max: the app is usually enough.
- A supplement brand with subscriptions, bundles and a post-purchase upsell: GTM gives you control over item data and upsell timing.
- A store sending the same events to GA4, Meta and TikTok from one place: GTM keeps naming and triggers consistent.
If you are still deciding which GA4 settings matter, our general guide to setting up Google Analytics 4 with Google Tag Manager covers the property side; this guide stays on Shopify.
How Do You Install GA4 With the Google & YouTube App?
Install the Google & YouTube app, connect your Google account, and select your GA4 property. Google’s Shopify guide calls this the strongly preferred option.
- In Google Analytics, confirm you have Editor access and a web data stream for the store.
- Install the Google & YouTube app from the Shopify App Store.
- On the app’s Overview page, select Get started in the Google Analytics section.
- Connect your Google account, choose the GA4 property, and confirm.
- If you can’t connect automatically, add the Google tag manually in the app’s Settings page and save.
- Remove any other GA4 code (theme snippets, old apps, GTM tags) that sends to the same property.
Shopify notes you don’t need to connect Merchant Center to finish the GA4 tag setup. If you only wanted the app route, skip to the testing section.
How Do You Add Google Tag Manager to Shopify in 2026?
Load your GTM container inside a custom pixel. Shopify’s GTM page says this works for all stores with custom web pixels, and the custom pixel is now the only supported way to get GTM data from the upgraded checkout.
Shopify set a deadline of August 28, 2025 to upgrade the Thank you and Order status pages, and began automatic upgrades in January 2026 (as of October 2026). Those upgrades drop Additional scripts, script-tag apps and checkout.liquid customizations, which is why many stores lost purchase tracking without noticing.
Step 1: Remove Old Tracking Code
Shopify’s custom pixel guide says to remove or change existing pixels first, including code in theme.liquid, checkout.liquid (Shopify Plus only) and Additional scripts. Note what each one tracked before you delete it.
Step 2: Create the Custom Pixel
In Shopify admin, go to Settings > Customer events, add a custom pixel, and give it a clear name such as “GTM – GA4”.
Step 3: Set Customer Privacy
In the Customer privacy section, set Permission to Required and pick the purposes that apply (analytics, marketing, preferences), or Not required if your policy allows it. Set Data sale to match your privacy obligations.
Shopify’s sample GTM pixel grants every consent type, and Shopify says it may not match your region’s rules. If you serve visitors in places that require consent, read our Consent Mode v2 setup guide before you go live.
Step 4: Paste the GTM Loader
In GTM, open Admin and copy the install snippet meant for the page head. Remove the opening and closing script tags and paste the rest into the pixel’s Code window.
window.dataLayer = window.dataLayer || [];
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');Step 5: Subscribe to Shopify Events
Below the loader, subscribe to each Shopify customer event and push a GA4-named event into the dataLayer. The full mapping is in the next section; here is the purchase event as a pattern.
analytics.subscribe("checkout_completed", (event) => {
const c = event.data.checkout;
window.dataLayer.push({ ecommerce: null });
window.dataLayer.push({
event: "purchase",
ecommerce: {
transaction_id: c.order?.id,
value: c.totalPrice?.amount,
currency: c.currencyCode,
items: c.lineItems.map((li) => ({
item_id: li.variant?.sku,
item_name: li.title,
price: li.variant?.price?.amount,
quantity: li.quantity
}))
}
});
});Shopify’s checkout_completed reference says totalPrice includes duties, taxes and discounts. If you report revenue without tax and shipping, calculate value from the line items instead and keep that choice consistent.
Step 6: Save and Connect
Save the pixel, then select Connect pixel. A saved but disconnected pixel sends nothing.
FREE TRACKING AUDIT
Find Out Which Conversions You Are Missing
JuvioX reviews your GA4, Tag Manager and ad platform tracking, then sends a prioritized list of what to fix first. Free, with no obligation.
How Do You Track Add to Cart, Checkout and Purchases With Shopify Customer Events?
Subscribe to Shopify’s standard events in the pixel and translate each one into the matching GA4 ecommerce event. Shopify’s GTM tutorial maps checkout_completed to purchase, product_added_to_cart to add_to_cart and product_viewed to view_item; the rest follow the same idea.
| Shopify customer event | GA4 event |
| page_viewed | page_view |
| collection_viewed | view_item_list |
| product_viewed | view_item |
| product_added_to_cart | add_to_cart |
| cart_viewed | view_cart |
| checkout_started | begin_checkout |
| checkout_shipping_info_submitted | add_shipping_info |
| payment_info_submitted | add_payment_info |
| checkout_completed | purchase |
A few Shopify details change how you build this:
- checkout_completed fires once per checkout, normally on the Thank you page. If you use a post-purchase upsell, it fires on the first upsell page instead.
- If that page fails to load, Shopify says the event doesn’t fire, so a small gap against Shopify orders is normal.
- Shopify doesn’t let you add custom data to standard events. For anything extra, publish your own custom event from the theme with analytics.publish().
- GA4 Enhanced Measurement can’t auto-track outbound link clicks inside the pixel, so send those as custom events if you need them.
For a store that also sells on WooCommerce, the event names are the same; the WooCommerce GA4 ecommerce guide shows the dataLayer side for that platform.
How Do You Set Up the GA4 Tags in GTM for Shopify Events?
Create one Google tag, then one GA4 Event tag per event, each fired by a custom event trigger whose name matches the event you pushed. Shopify notes that at least one tag and one trigger must exist before any data moves.
- Google tag: your G-XXXXXXX ID. Shopify warns that GA4 page URLs from the sandbox can include sandbox details, so turn off automatic page views in this tag and send page_view from the page_viewed event instead.
- Data Layer Variables: one each for ecommerce.transaction_id, ecommerce.value, ecommerce.currency and ecommerce.items.
- Triggers: Custom Event triggers named in plain Title Case, such as “Purchase” for the purchase event and “Add To Cart” for add_to_cart.
- Tags: separate GA4 Event tags named Platform – Event – Tag, such as “GA4 – Purchase – Tag” and “GA4 – Begin Checkout – Tag”, with ecommerce data sent from the dataLayer.
Google tag config parameter: send_page_view = false
Trigger "Purchase": Custom Event, event name = purchase
Tag "GA4 - Purchase - Tag": GA4 Event, event name = purchaseKeeping one tag per event makes debugging faster: when purchases drop, you open one tag and one trigger, not a shared tag with a lookup table.
How Do You Stop Double-Counting Purchases on Shopify?
Send each GA4 event from one source only, and always pass the Shopify order ID as transaction_id. Google’s ecommerce guide lists transaction_id as required for purchases.
Duplicates almost always come from two sources running at once. Common pairs:
| Source A | Source B | Fix |
| Google & YouTube app | GTM custom pixel GA4 tags | Keep one; disconnect GA in the app or remove the GA4 tags |
| Theme GTM container | GTM in a custom pixel | Remove the theme container or its GA4 tags |
| Third-party analytics app | Your own pixel | Turn off GA4 in the app |
| Old GA4 property | New GA4 property | Check which stream each tag uses |
Google’s Shopify guide also says to remove legacy tags to prevent duplicate measurement. If you also run Google Ads, decide where Google Ads conversions come from as well; the enhanced conversions setup guide covers that side.
How Do You Test Your Shopify GA4 Setup?
Place a real test order and watch it arrive at every step. Shopify says Google Tag Assistant’s troubleshoot feature doesn’t work with custom pixels, so use Shopify Pixel Helper for the pixel and GA4 DebugView for the data.
- Open the store with Shopify Pixel Helper, browse a collection and a product, and add to cart.
- Go through checkout: contact, shipping and payment, and confirm each event shows in Pixel Helper.
- Complete the order and check checkout_completed on the Thank you page (or first upsell page).
- In GA4 DebugView, open the purchase event and confirm transaction_id, value, currency and items.
- Refresh the Thank you page and confirm no second purchase appears.
- A day later, compare GA4 purchases with Shopify orders for the test window.
Small gaps between GA4 and Shopify are expected, because Shopify records every order on its server and GA4 depends on the browser. Our post on why GA4 and Shopify numbers don’t match explains how big a gap is normal. If the gap stays large after setup, server-side tracking is the next step; see how to set up server-side tracking on Shopify.
Troubleshooting Shopify GA4 and GTM
Most problems fall into a few patterns. Work down this table before rebuilding anything.
| Problem | Likely cause | Fix |
| No purchases in GA4 | Pixel saved but not connected, or old Additional scripts removed by the upgrade | Connect the pixel; rebuild purchase on checkout_completed |
| Purchases counted twice | App and GTM both send GA4 | Keep one source |
| Events in Pixel Helper, not in GA4 | No matching GTM trigger, or wrong G- ID | Match trigger names to pushed events; check the ID |
| Odd page paths in GA4 | Automatic page views from the sandbox | Turn off automatic page views; use page_viewed |
| Nothing fires for some visitors | Customer privacy set to Required and consent not given | Expected; check your consent setup |
| Purchase missing on upsell orders | Event fires on the first upsell page | Test the upsell path separately |
| Items empty on purchase | Wrong field path in the pixel code | Log event.data and fix the mapping |
| Tag Assistant shows nothing | Tag Assistant can’t see custom pixels | Use Shopify Pixel Helper |
When Should You Get Help With Shopify Tracking?
Get help when purchases have been missing for weeks, when ad platforms and GA4 disagree badly, or when you need GA4, Google Ads and Meta running from one clean setup. Our Tracking & Analytics service covers Shopify audits and rebuilds on a flat monthly management fee, month-to-month with no lock-in, and every engagement starts with a free audit.
FREE TRACKING AUDIT
Find Out Which Conversions You Are Missing
JuvioX reviews your GA4, Tag Manager and ad platform tracking, then sends a prioritized list of what to fix first. Free, with no obligation.
FAQ
Frequently asked questions
Can I Use GTM on Shopify Checkout Without Shopify Plus?
Yes. Shopify says Google Tag Manager is available to all stores through a custom web pixel, so you don't need Shopify Plus. Checkout events such as checkout_started and checkout_completed reach GTM through Shopify's customer events rather than through code in checkout.liquid, which was a Plus-only option and is no longer how upgraded checkouts work.
Why Is My Shopify Purchase Event Not Showing in GA4 Even Though GTM Fires?
The usual causes are a GA4 Event tag with no matching trigger, the wrong Measurement ID, or a purchase pushed without a transaction_id, value or currency. Check the event in Shopify Pixel Helper first, then open GA4 DebugView and confirm the purchase arrives with its parameters. Remember that Tag Assistant's troubleshoot feature does not see custom pixels.
Can I Still Use dataLayer.push From My Shopify Theme?
Theme code can still run on storefront pages, but it does not reach the upgraded checkout, and Shopify suggests replacing older dataLayer.push calls with analytics.publish() so the custom pixel receives them. That keeps one path for every event and avoids two containers sending the same data.
Does the Shopify Custom Pixel Affect Consent Mode?
It can. Shopify's sample GTM pixel grants every consent type, and the pixel's own Customer privacy setting decides whether it loads for a visitor at all. If you need Consent Mode v2, set the pixel's permission to match your banner and update consent states in the pixel code based on Shopify's customer privacy status instead of granting everything by default.
Can I Send Shopify Customer Email to Google for Enhanced Conversions?
Shopify's checkout_completed reference lists email and phone fields but marks them as needing specific access scopes, so confirm in a test order what your pixel actually receives before you build on it. Many stores use the Google & YouTube app for Google Ads conversions and keep the custom pixel for GA4 only.
Why Does Shopify Show More Sales From Direct Than My Ad Platforms Report?
Shopify, GA4 and ad platforms use different attribution rules and lookback windows, and anything the browser tag misses tends to fall into Direct. Consistent UTM tags, one clean GA4 source and checking payment gateway referrals usually narrow the gap, but the numbers will never match exactly.
6 sources & references
- Shopify Help Center Google Tag Manager help.shopify.com
- Shopify Help Center Create a Google Tag Manager custom pixel help.shopify.com
- Shopify Help Center Manage your custom pixels help.shopify.com
- Shopify Dev checkout_completed shopify.dev
- Tag Manager Help Shopify: Set up your Google tag support.google.com
- Google for Developers Measure ecommerce developers.google.com
Official pages we checked when writing this article.






