There are three ways to set up GA4 on a Shopify store today: Shopify’s Google & YouTube app, Google Tag Manager through a custom pixel, or a tracking app. Since Shopify moved checkout tracking to Customer events, some older tutorials no longer work. Here is how each method works now, and how to choose.
Method 1: the Google & YouTube app
Shopify’s own app connects your store to GA4 and Google Ads.
- Install the Google & YouTube app and connect your Google account.
- Select your GA4 property in the app’s settings.
- Place a test order and check the events in GA4’s DebugView or Realtime report.
Google has also been rolling out a server-to-server connection for stores using the app, which sends purchases from Shopify’s servers to GA4 and Google Ads. It can be switched off in the app’s settings, and it must be if another tool already sends purchases to GA4. I compare the app with a custom setup in Google & YouTube app vs server-side GTM.
Pros: free, quick, standard ecommerce events, works with Shopify’s consent settings. Cons: you can’t add custom events or parameters, debugging is limited, and you can’t easily combine it with other tags without creating duplicates.
Method 2: Google Tag Manager in a custom pixel
This is the method I use for most stores, because it gives full control and feeds every platform from one data layer.
- Create a GTM web container, and a server container if you plan to go server-side.
- In Shopify, go to Settings → Customer events → Add custom pixel, and load GTM inside the pixel.
- Subscribe to Shopify’s standard events and push them to the data layer in GA4’s ecommerce format.
- In GTM, create the GA4 tags and triggers for each event.
- Set the pixel’s permissions so it follows the visitor’s consent.
Here is a simplified example for the purchase:
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,
tax: c.totalTax?.amount,
shipping: c.shippingLine?.price?.amount,
items: c.lineItems.map((li) => ({
item_id: li.variant?.product?.id,
item_name: li.title,
item_variant: li.variant?.title,
price: li.variant?.price?.amount,
quantity: li.quantity
}))
}
});
});
Two things surprise people. Custom pixels run in a sandbox: they can’t read or change your theme’s page, and the page URL GA4 sees must be set from the event data rather than read from the browser. And GTM’s preview mode is harder to use inside a pixel, so testing relies more on GA4’s DebugView and real test orders.
Method 3: a tracking app
Apps such as Analyzify or Elevar provide a ready-made data layer and GA4 setup, often with server-side options. They are a middle ground: more control than the native app, less work than a custom setup, with a subscription. I compare them in Elevar vs Analyzify vs Stape vs custom GTM.
Shopify events and their GA4 equivalents
| Shopify customer event | GA4 event |
|---|---|
| page_viewed | page_view |
| collection_viewed | view_item_list |
| product_viewed | view_item |
| search_submitted | search |
| product_added_to_cart | add_to_cart |
| product_removed_from_cart | remove_from_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 |
GA4 settings to check on any method
- Timezone and currency identical to your Shopify store, otherwise daily numbers never line up.
- Referral exclusions for payment providers such as PayPal, so returning buyers don’t start a new session credited to the payment site.
- Internal traffic excluded, including test orders.
- Data retention set to 14 months.
- Purchase marked as a key event.
- One method only: never run the app and a GTM purchase tag at the same time. See duplicate purchase events.
Check that it works
Place a real order and check it in DebugView. Then, after a week, match GA4 purchases with Shopify orders by order ID, as explained in why GA4 shows fewer purchases than Shopify.
Which method should you choose?
- Small store, no paid ads yet: the Google & YouTube app.
- Running ads on several platforms, or need custom events: GTM in a custom pixel, ideally with server-side tracking.
- Want a packaged product with support: a tracking app.
If you’d rather have it done and checked against your orders, my Starter package sets up GA4 with GTM and Consent Mode v2 for 1,300€, and the Professional package adds server-side tracking for every ad platform. See the Shopify tracking packages or book a free call.