Connect Google Analytics 4 with Shopify

By Ilana Davis

The long-awaited Google Analytics 4 and Shopify integration is available via the Google Sales Channel App.

Keep in mind that this integration, much like Universal Analytics, connects the property to your Shopify store. You still need to determine if more setup in Google Analytics 4 is required. Please don't @ me on how to do this as it's outside of my expertise. Instead, reach out to Kate Collinson and check out her GA4 course.

Connecting Shopify & Google Analytics 4 using their preferred method

In this article, I'm assuming that you already have a Google Analytics 4 property setup. If you do not, you'll want to do that first. You can use Google's instructions and Shopify's instructions to set up your Google Analytics 4 property.

I'm also assuming you don't use another service or app to connect your Google Analytics 4 property to Shopify. If you do, please contact them.

Step 1: The Google Sales Channel App

If you've already installed the Google Sales Channel app, skip to the next step.

First, you'll want to install the Google Sales Channel App. This is the only way to connect your Google Analytics 4 data with Shopify unless you edit the theme files.

When you edit your theme files, you may not be eligible for easy theme updates. That's why many apps, including JSON-LD for SEO, have moved away from editing your theme files.

I understand that many people do not like the Google Sales Channel for Merchant Center and Google Shopping Feeds. That's ok! You can use whatever product feed you want and do not have to connect Merchant Center to the app anymore.

If installing the Google Sales Channel app is new, connect the app to your Google account. This should be the same email that has access to your GA4 property.

Step 2: Connect to your Google Analytics 4 property to Shopify

At the time of this writing, when you first land on the app page, you'll see a blue box to set up Google Analytics 4 without using Merchant Center.

A blue box at the top of the sales channel that says Looking only to set up Google Analytics 4? You can setup Google Analytics and get insights into your online stores performance without a Google Merchant Center account. Then a button to get started.

If you already have Merchant Center and would like to connect it that way, you should see a box further down that should connect Merchant Center with Google Analytics 4.

Google Analytics 4: Optimize your business with Google Analytics. Get insights into the market and make smart business decisions with Google Analytics 4, our next-generation measurement solution. Get started

Either way, select Get Started.

Step 3: Select the Google Analytics Property you want to connect

Once your Google Analytics account is connected, you should see a dropdown with the available properties. Select the GA4 property and select Connect.

Connect a Google Analytics property using the availble options in the dropdown.

You should now see a message that says: "Your site data is being shared with Google Analytics." or something similar because content changes often.

Step 4: If needed, remove the old GA4 code from your Shopify theme files

Many were ahead of the game and manually added the Google Analytics 4 code snippet to your theme files. If that's you, you'll want to remove that code so you don't double-track your visitors.

This was likely added to your theme.liquid file.

Go to Online Store -> Themes -> select the ellipsis ... -> Edit code.

In the Layout folder, go to theme.liquid and search for your Google Analytics code to remove it.

An alternative method to connect Shopify & Google Analytics 4

If using the Google Sales Channel App is not workable for you, there is another option. You can manually add the GA4 code snippet to your theme files.

This method is not recommended because you are editing the theme files directly. Shopify is trying to move everyone away from editing the theme files.

Manually add the Google Analytics 4 snippet to your Shopify theme

Grab your Google Analytics 4 snippet. It should look something like this but don't copy this code as you need your unique ID:

    <script async src=""></script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'X-XXXXXXXXXX');

In Shopify, go to Online Store -> Themes -> select the ellipsis ... -> Edit code.

In the Layout folder, go to theme.liquid and search for the closing </head> tag. You'll want to paste the GA4 snippet just above the closing tag.

Checking your work

Head over the Google Analytics to make sure it's tracking.

For this article, you're just looking to make sure visits are showing up. It may take some time depending on how many visitors you have. Google says it can take up to 48 hours. If after that time you still don't see the tracking code working and you know you've had visitors, contact Google for help.

Again, if you have not set up conversion funnels and the like, you'll want to reference the links above.


Get more organic search traffic from Google without having to fight for better rankings by utilizing search enhancements called Rich Results.

Linking Llama

Link discontinued products to their best substitute. Keep discontinued products published on your website and continue to benefit from traffic to these pages.