Installing Google Analytics 4 on Shopify: 3 Methods

An experienced expert and coach in technical marketing. I help companies bridge the gap between marketing strategy and their data by helping them really use their data. Got curious?

Setting up GA4 on Shopify seems simple, but the method you choose determines how reliable your e-commerce data will be—especially since Shopify has secured the checkout process. I outlined the options in a guest blog post for Analytics Mania. Here are the key points.

1. Shopify's Google & YouTube app

You link your Google account and GA4 property in the app, along with the standard e-commerce events such as view_item, add_to_cart, start_checkout and purchase are measured automatically.

  • Advantage: Ready in just a few minutes.
  • Disadvantage: You can't customize anything, debugging is difficult, and the purchase data isn't always reliable.

2. Google Tag Manager via a custom pixel

You load GTM into a custom pixel under "Customer Events." That pixel runs in a sandbox environment and sends events to the dataLayer. In GTM, you then set up your GA4 tags and e-commerce events yourself.

  • Advantage: full control, better data quality, and room for other pixels such as Meta.
  • Drawback: It’s more technical; you have to set up e-commerce events yourself; Preview mode doesn’t work during checkout; and triggers such as clicks and scrolls don’t work in the sandbox.

In this setup, turn off Enhanced Measurement; otherwise, you'll end up with corrupted data.

3. gtag in theme.liquid

You paste the GA4 code into your theme and a purchase script on the order status page. This is the old way: you don't reach the checkout, and every additional event requires a developer. Use this only in situations where the other two options aren't possible.

What about paid apps?

There are also apps that set up GA4 and e-commerce for you. They're user-friendly, but you pay a monthly fee and you're dependent on the app.

Which one will you choose?

If you want something that works quickly, use the app. If you want data you can rely on, choose GTM via a custom pixel. Also, think about consent in advance: those settings help determine which method is right for you.

Read more

Read the full article on Analytics Mania for a step-by-step guide, or contact us if you'd like us to set up your Shopify tracking.

Blogs

Related articles

Are you ready for the next step?

Get in touch