Shopify GA4 Ecommerce Tracking Setup with Google Tag Manager
By Alessandro Colarossi, Founder, Triangle Digital · Published · 9 min read
Short answer
To set up GA4 ecommerce tracking on Shopify with Google Tag Manager: add a Google tag with your GA4 Measurement ID, make sure your Shopify data layer and Customer Events pixel push GA4 ecommerce events (view_item, add_to_cart, begin_checkout, purchase and the rest, each with currency, value and items), create GA4 Event tags that read the ecommerce data from the data layer, mark purchase as a key event, then verify in DebugView and the Ecommerce purchases report.
What you need before you start
- A GA4 property with a Web data stream and its Measurement ID (
G-XXXXXXXXXX). - Google Tag Manager installed on your store, including checkout. See the GTM setup guide.
- A Shopify data layer and Customer Events pixel sending GA4-format events. See the data layer guide and Customer Events guide.
- Any other GA4 source removed: the Google & YouTube app's analytics, hardcoded gtag.js, or old Additional Scripts code.
Step 1: Add the Google tag in GTM
In GTM create a new tag of type Google tag (this replaced the old “GA4 Configuration” tag), enter your Measurement ID as the Tag ID, and trigger it on Initialization – All Pages. This loads GA4 and sets the foundation every event tag relies on. Do the same inside the Customer Events pixel container if you run a separate GTM instance there.
Step 2: Know which events and parameters GA4 expects
GA4 builds its ecommerce funnel and monetization reports from a specific set of recommended events. Send these with the parameters shown, and the reports populate without custom work:
| Event | When | Key parameters |
|---|---|---|
view_item_list | Collection or search results shown | items, item_list_id, item_list_name |
select_item | Product clicked from a list | items |
view_item | Product page viewed | currency, value, items |
add_to_cart | Item added to cart | currency, value, items |
remove_from_cart | Item removed | currency, value, items |
view_cart | Cart viewed | currency, value, items |
begin_checkout | Checkout started | currency, value, items, optional coupon |
add_shipping_info | Shipping submitted | currency, value, items, shipping_tier |
add_payment_info | Payment submitted | currency, value, items, payment_type |
purchase | Order completed | transaction_id, currency, value, items, optional tax, shipping, coupon |
search | Site search | search_term |
Step 3: Create the GA4 Event tags
You have two reasonable patterns. Both read the ecommerce object straight from the data layer when you tick Send Ecommerce data and select Data Layer as the source.
- One tag per event. Easiest to customize and audit: a
GA4 - purchasetag on apurchaseCustom Event trigger, and so on. - One tag for all ecommerce events. Set Event Name to the built-in variable
{{Event}}and fire it on a Custom Event trigger that uses regex matching, for example^(view_item_list|select_item|view_item|add_to_cart|remove_from_cart|view_cart|begin_checkout|add_shipping_info|add_payment_info|purchase)$. Fewer tags to maintain, less flexibility per event.
Whichever you choose, each event must fire once per user action. Preview mode will tell you if it does not.
Step 4: Get the purchase event right
purchase is the event that matters most, and where most Shopify setups go wrong. Checklist:
- `transaction_id` is present and unique (use the Shopify order ID). GA4 uses it to avoid counting the same order twice, and other platforms rely on it too, so never skip it.
- `value` is a number and means the same thing everywhere (see value definition).
- `currency` is a valid ISO code like
USDorCAD. - `items` is a non-empty array with
item_id,item_name,priceandquantity. - The event is sent from the checkout_completed pixel event only, not also from the theme.
Step 5: Mark purchase as a key event
In GA4 go to Admin → Events (or Key events) and mark purchase as a key event. GA4 renamed “conversions” to “key events”, and this flag is what makes the event usable for conversion reporting, audiences and importing into Google Ads. You can mark begin_checkout and add_to_cart too if you want funnel conversion rates.
Step 6: Fix unwanted referrals and cross-domain issues
Shoppers often leave your store to pay (PayPal, Klarna, Afterpay, bank redirects) and come back. If GA4 sees that return as a new session, the sale is credited to “paypal.com / referral” instead of the real source.
- In GA4: Admin → Data streams → your web stream → Configure tag settings → Show all → List unwanted referrals, and add your payment providers' domains.
- If your checkout runs on a different domain or subdomain than your storefront, add both under Configure your domains so sessions are not split.
Step 7: Verify before you trust the numbers
- Open GTM Preview, connect Tag Assistant to your store and run a full journey ending in a test order.
- In GA4 open Admin → DebugView and confirm each event arrives with the expected parameters.
- Check Reports → Realtime for the events firing live.
- After processing (up to a day), open Monetization → Ecommerce purchases and confirm items, revenue and transactions populate.
- Compare a day of Shopify orders against GA4 transactions. See the next section for expected gaps.
If something is missing or duplicated, work through the debugging guide.
Why GA4 never exactly matches Shopify
Even a perfect setup will differ slightly from Shopify's own reports. The usual reasons:
- Consent and privacy. Visitors who decline analytics consent are not measured, and ad blockers stop some requests.
- Order types GA4 never sees: POS sales, draft orders created by staff, and orders created outside the online store checkout.
- Refunds and cancellations. GA4 counts the original purchase unless you send refund events.
- Time zones and attribution. Shopify reports in your store time zone and its own attribution; GA4 uses its property time zone and models.
- Test orders that were counted in one system and filtered in the other.
A consistent gap of roughly the share of consent-declined or ad-blocking visitors is normal. A large or variable gap usually means a tracking bug.
Skip the manual tag building
The Shopify DIY Tagging Packs include a GTM container with the full GA4 ecommerce event set already built, including the purchase event, plus the data layer and Customer Events pixel that feed it. You replace a few variables (your GA4 Measurement ID, Google Ads IDs) and publish.
Frequently asked questions
How do I set up GA4 ecommerce tracking on Shopify?
Install Google Tag Manager on your store including checkout, push GA4-format ecommerce events into the data layer, create a Google tag and GA4 Event tags in GTM, mark purchase as a key event, and verify with DebugView.
Which GA4 ecommerce events does Shopify need?
At minimum view_item, add_to_cart, begin_checkout and purchase. A full setup also sends view_item_list, remove_from_cart, view_cart, add_shipping_info, add_payment_info and search.
Why are my GA4 purchases lower than my Shopify orders?
Common reasons are consent declines, ad blockers, POS and draft orders that never hit online checkout, and timing differences. A large or unstable gap usually points to a tracking issue.
Does GA4 de-duplicate purchases automatically?
GA4 uses transaction_id to avoid counting the same transaction twice, but you should not rely on that alone. Make sure purchase is sent once, from one source, with a unique transaction_id.
Do I mark purchase as a conversion or a key event?
Key event. GA4 renamed conversions to key events, so mark purchase as a key event in Admin to use it for conversion reporting and Google Ads imports.
