Back to Blog List

How to Set Up Google Analytics 4 (GA4) for Your Shopify Store

GemPages Team
Updated:
14 minutes read
Shopify GA4

To achieve success in eCommerce, you need to have a data-driven approach.

And to develop this approach, Google Analytics 4 (GA4) is one of the best tools for eCommerce entrepreneurs.

Google Analytics is a free platform that lets you collect and analyze data of your website and app visitors. These data insights help you know customer behavior and enhance your online business.

GA4 is the upgraded version of Universal Analytics. From July 1, 2023, Universal Analytics properties will stop processing data and only GA4 properties will collect data. 

If you’re looking to set up Shopify GA4 configuration from scratch or migrate your existing Universal Analytics setup to GA4, we’ve got you covered. In this blog post, we’ll walk you through the step-by-step processes for both of these scenarios.

How to Migrate from Universal Analytics to GA4 on Shopify

If you already have Universal Analytics (UA) tag set up on your Shopify store, it can be migrated to the new GA4 tag in two different ways:

  1. You can manually migrate your Universal Analytics property to the new GA4 property.
  2. If you don’t manually migrate it, Google will automatically create a GA4 property for you (based on your current UA settings), unless you opt out of it through Setup Assistant.

You might think — if Google is going to do it for me, why should I manually migrate UA to GA4?

Well, here’s the answer! Google strongly recommends to manually migrate your Universal Analytics settings to the new GA4 property. It's because all UA configurations may not have the exact GA4 counterpart, and you might want to make different choices than the automated migration process.

So, here’s the step-by-step guide to manually migrate from Universal Analytics to GA4: 

Step 1: Create a New GA4 Property

Open your Google Analytics account, and you’ll see this notification if you have a UA property that’s not moved to GA4:

Google’s notification for a Universal Analytics property

Click on the Go to Setup Assistant button below the timer. Then, you’ll see two different options: 

1. “I want to create a new Google Analytics 4 property”
2. "I want to connect to an existing Google Analytics 4 property"

Google Analytics 4 Property Setup Assistant

If you already have a new GA4 property, you can go for option 2. However, since you’re here for migrating from UA to GA4, the most likely scenario we could imagine is that you don’t have a GA4 property yet.

If that’s the case, click on the Get Started button under “I want to create a new Google Analytics 4 property”. Then, you’ll find a pop-up with a brief description of how the setup assistant will help you.

create new property

In this pop-up, you’ll see a checkbox that says, “Enable data collection using existing analytics.js and gtag.js tags.” If your existing UA configuration is done with analytics.js and gtag.js, you can enable this option to start collecting data from those tags to your new GA4 property.

However, if you're planning to set up GA4 tags, we'd recommend keeping this unchecked, because you may end up receiving inaccurate data with double-counting. So basically, this step depends on how your UA setup was done and how you want to configure your new GA4 setup. 

For this demo, we’ll leave it unchecked and click on Create and continue. Now, you’ll see two options to set up a Google tag:

1. Install with Shopify [Recommended]
2. Install manually

Since Google recommends option 1 (Install with Shopify), we’ll go with it and click Next.

set up google tag

Now, you’ll see a window showing ‘Installation instructions’. But you no longer need to follow these instructions as now Shopify allows you to automatically connect with your Google Analytics 4 property through Google & YouTube sales channel. Just click on Done to close this window.

ga 4 migration

Step 2: Set Up ‘Google & YouTube’ Sales Channel

2.1 Install ‘Google & YouTube’ sales channel

Now, go to your Shopify admin and click on the Sales channels tab on the left sidebar. Type ‘Google’ in the search bar to find the ‘Google & YouTube’ sales channel. Click to open it in the Shopify App Store.

Shopify admin - Sales channels

Now, click on the Add app button to proceed with the installation.

Shopify App Store - Google & YouTube sales channel

Click on the Add sales channel button and complete the installation.

Shopify admin - Adding Google & YouTube sales channel

Learn more: How to Connect Your Shopify Store to YouTube?

2.2 Connect Your Google Account

Once you’ve installed the Google & YouTube sales channel, you’ll be asked to connect your Google account. Connect the Google account with which you just created your Google Analytics account.

Shopify admin - Google & YouTube sales channel

2.3 Set up Google Analytics for Shopify in App Setup

Under the App setup section, you’ll find a highlighted box that says, “Looking only to set up Google Analytics 4?” Click on the Get started button in that box.

Shopify admin - Google & YouTube sales channel

Once you click on the Get started button, you’ll go to the next page - Get started with Google Analytics 4. Since you’ve already connected your Google account, you’ll find your newly created GA4 property auto-populated in the Connect a Google Analytics property section. Click on the Connect button.

Shopify admin - Google & YouTube sales channel

Now, your new Google Analytics 4 property is connected to your Shopify store.

Shopify admin - Google & YouTube sales channel

Step 3: Complete Your Google Analytics 4 Property Settings

Now, go to your Google Analytics account to complete the configuration of your new GA4 property. Click on the ‘Go to your GA4 property’ button.

ga4 migration

As you can see, the banner says, “This property’s setup is not complete.

ga 4 migration

Under the Setup Assistant, you can configure settings for:

  • Data collection
  • Property settings
  • Google Ads
  • Advanced setup (optional).

Click on the arrow icon (>) next to ‘Not Started’ and you can configure all these settings one by one depending on how you want to collect the data. We’ll not go much into detail about this because these settings and the goals or data requirements may vary from business to business. You can click on the ‘Learn more’ link for each of these settings to know about them.

Set Up Google Analytics 4 (GA4) on Shopify from Scratch

If you’re totally new to Google Analytics and wondering how to install GA4 on Shopify, we’ll help you set it up from scratch. There are two different ways to add GA4 to Shopify:

  • Set up GA4 with the ‘Google & YouTube’ Sales Channel
  • Set up GA4 with Google Tag Manager (GTM)

We’ll cover the first method — setting up GA4 with Google & YouTube sales channel — which is relatively easy to set up.

The Step-by-Step Guide for Shopify Google Analytics 4 Setup

Step 1: Check if Google Analytics is Already Configured

First things first, make sure your store does not already have Google Analytics configured or its older version, i.e., Universal Analytics. Some store owners might have Universal Analytics configured when they initially created their Shopify stores or the developers might have done it for them.

1.1 Check Google Analytics Section:

Go to Shopify admin, click on Online Store > Preferences, and then check if you have any code in your Google Analytics section. If it’s blank, we can move forward to the further steps.

Google Analytics section in Shopify admin

If it has the code, it means Google Analytics was installed previously. So, if you already have a Universal Analytics tag, you can migrate it to a new Google Analytics 4 tag by following the migration guide we shared above. 

Or if you want to go with creating a GA4 property from scratch, remove the code, and continue following further steps in this guide.

1.2 Check the Order Status Page

The Order status page section is typically used by some merchants or developers to add the Google Tag Manager (GTM) code. If the Additional scripts box is empty, we’re good to go and can move forward with further steps. If you find a GTM container code here, we recommend removing it so that we can have a clean GA4 configuration.

Order status page in Checkout settings

1.3 Check Code in Your Theme Files

The last section we need to check is your theme file. Go to Online Store > Themes and go to more options by clicking on the three dots in your current theme section. Then, click on the Edit code option.

Shopify admin - Current Theme section

Click on the ‘theme.liquid’ file in the Layout folder. Check if you have a Google Tag Manager container code right below the <head> tag. If yes, remove it. If no, we can move forward to the next step.

Shopify theme file

If you had hired someone to add all these codes and you’re not sure what was added and where — you can ask for their help to remove those codes.

Faster and easier page building with GemPages
Building pages has never been easier with GemPages. Try creating your own page right now. No codes needed.

Step 2: Create Google Analytics Account

2.1 Create a Google Account

First, you need a Google account to create and set up Google Analytics 4. Most likely, we all have at least one Google account to use its products like Gmail, Drive, Calendar, etc. While you can use the same Google account, we’ll recommend creating a new Google account solely for business purposes.

Click here to create a Google account for your business. Fill in all the necessary details and complete the account creation.

Google account sign-up page

2.2 Create a Google Analytics Account

Now, you can create a Google Analytics account with the Google account that you just created. You can find the Google Analytics signup page from Google or directly click on this link to create a Google Analytics account.

If you already have a Google Analytics account, you can click on the Sign in to Analytics button, or else, click on the Get started today button.

Google Analytics 4 account set up

On the next page, click on the Start measuring button.

Google Analytics 4 account set up

Then, fill in all the necessary details for account creation and create your Google Analytics 4 property.

Enter your account name:

In this field, you can mention your company name. Or if you have a parent company managing different businesses, you can insert the parent company name and then create a different property for each business website separately.

For this demo, we’ve inserted “GemPages Guide” as the account name.

Google Analytics 4 account set up

Create a property:

In Google Analytics, the term “property” refers to a website, mobile application, blog, etc. — and each of them is associated with a unique tracking ID. You can have one or multiple (up to 2,000) properties in a Google Analytics account.

For example, in this demo, we’ve created a property name - “GemPages Guide Shopify Store”. If we have another website, let’s say “GemPages Design Store”, we can create a new property for separate tracking and data collection for both websites.

Google Analytics 4 account set up

Right before the Next button, you’ll see a “Show advanced options” tab. You can leave it just as is—nothing is required. That option lets you create a Universal Analytics property. However, as mentioned earlier, Google will be sunsetting Universal Analytics in July 2023 anyway. So, it’s not recommended to enable this option.

Google Analytics 4 account set up

If you need more help understanding how you should structure your GA4 account, here are some examples of best practices shared by Google:

Example of GA4 account structure

Enter your business details:

Under the Industry category, select the industry type most relevant to your business. Under the Business size, click on the right option per the number of employees working under your business.

Example of GA4 account structure

Choose your business objectives:

Depending on your objectives and requirements for the reports, you can choose one or more options in this step.

GA4 setup - business objectives

Review and accept the Google Analytics Terms of Service Agreement:

Once you click the Create button, you’ll see a pop-up window with Google’s terms of service agreement. Make sure to choose your country/region before you review and accept the terms of service agreement.

Google Analytics Terms of Service Agreement

Choose your platform:

Since we want to collect data from our Shopify website, we’ll choose the first option Web. But if you want, you can also skip this option by clicking on the Skip for now button.

Google Analytics 4 set up

Set up your data stream:

Enter your Website URL (custom domain name) and create a Steam name. Make sure that the Enhanced measurement option is enabled. It'll help you automatically measure the interactions of your website visitors on top of the standard page view measurement. 

Once done, click on the Create stream button.

Google Analytics 4 - Data stream

Then, you’ll see the Installation instructions window. Just close it and go to the second window - Web stream details.

Google Analytics 4 - Installation instructions

Add conditions to list unwanted referrals:

Under Web stream details, go to Configure tag settings > Settings, and then click on ‘Show all’. Then, click on List unwanted referrals. Add conditions here to ensure that self-referrals won’t display in your GA4 reports. 

You can add conditions to ignore referrals coming from your myshopify.com domain and the custom domain. Once conditions are added, click Save and close the window.

Google Analytics 4 settings

Once setup is completed, you may see this page that says, “It may take up to 48 hours before your property starts collecting data.”

Google Analytics page

Step 3: Set Up ‘Google & YouTube’ Sales Channel

3.1 Install ‘Google & YouTube’ sales channel

Now, go to your Shopify admin and click on the Sales channels tab on the left sidebar. Type ‘Google’ in the search bar to find the ‘Google & YouTube’ sales channel. Click to open it in the Shopify App Store.

Shopify admin - Sales channels

Now, click on the Add app button to proceed with the installation.

Shopify App Store - Google & YouTube sales channel

Click on the Add sales channel button and complete the installation.

Shopify admin - Adding Google & YouTube sales channel

3.2 Connect Your Google Account

Once you’ve installed the Google & YouTube sales channel, you’ll be asked to connect your Google account. Connect the Google account with which you just created your Google Analytics account.

Shopify admin - Google & YouTube sales channel

3.3 Set up Google Analytics for Shopify in App Setup

Under the App setup section, you’ll find a highlighted box that says, “Looking only to set up Google Analytics 4?” Click on the Get started button in that box.

Shopify admin - Google & YouTube sales channel

Once you click on the Get started button, you’ll go to the next section - Get started with Google Analytics 4. In this section, since you’ve already connected your Google account, you’ll find your GA4 property auto-populated in the Connect a Google Analytics property section. 

Now, it’s time to connect Shopify to Google Analytics 4. Click on the Connect button to link the GA4 property with your Shopify store.

Shopify admin - Google & YouTube sales channel

And that’s it! You’ll see the message saying —

"You've successfully set up Google Analytics 4".

Shopify admin - Google & YouTube sales channel

GemPages transforms the way you build pages
Give your page building a jumpstart by installing GemPages. Free plan available. No need to code.

How to integrate GA4 into GemPages?

While not all GemPages users require GA4 integration, it becomes necessary for store owners who plan to conduct A/B testing campaigns. 

A/B testing is a valuable practice for store owners looking to make data-driven decisions, enhance user experience, and ultimately boost their overall conversion rates.

Step 1: Setup Shopify Google Analytics 4 

Check the detailed instructions above on The Step-by-Step Guide for Shopify Google Analytics 4 Setup.

Step 2: Connect your A/B testing campaign

2.1 From the GemPages Dashboard, click on Settings in the left corner. Select Store settings then.

Integrate GA4 into GemPages

2.2 Under Analytics Tools, toggle on the Google Analytics switch. Choose the Google Account you want to connect to and allow the connection by agreeing to Google’s terms and conditions.

2.3 Choose the Accounts and Properties you’d like to track with A/B Testing. Integrate GA4 into GemPages

Now you’ve successfully synced your Google Analytics data with the A/B testing campaign report!

FAQs about GA4 Setup on Shopify

Is GA4 compatible with Shopify?
Yes, absolutely! You can set up Google Analytics 4 (GA4) on Shopify either through Google & YouTube sales channel or Google Tag Manager.
Is GA4 replacing Universal Analytics?
Yes. Google is sunsetting Uniserval Analytics in July 2023 and it will be replaced by Google Analytics 4 (GA4).
Does GA4 have eCommerce tracking?
Yes, it does. With GA4, you can track purchases and other events for your eCommerce business.
Why is GA4 important for eCommerce?
Google Analytics 4 (GA4) helps you analyze the data of your online store and optimize it for better customer experience and conversions.
Topics: 
Guides

Start selling on Shopify

Start with free trial, then get your first month for $1.

Start free trial
Shopify Sign Up Shopify Sign Up