How to Add Google Analytics to Shopify (Google Analytics 4 Guide)

How to add Google Analytics to Shopify (the Google Analytics and Shopify logos side by side).

In this simple step by step guide, we show you exactly how to add Google Analytics to your Shopify store.

What is Google Analytics 4?

Google Analytics 4 is the latest version of Google’s free analytics tool; it replaces the company’s ‘Universal Analytics’ product, which was in use between 2012 and 1 July 2023.

Google Analytics 4 provides more detailed information about user behavior on your website or online store (particularly where conversions and user journeys are concerned).

But it also gives people visiting your site more protection when it comes to their privacy.

The home dashboard in Google Analytics.
The Google Analytics dashboard.

Some of the data Google Analytics 4 gives you includes…

  • a real-time overview of your website traffic
  • the location of your users
  • how users got to your store pages
  • what type of device visitors used to access your store
  • how long people spend on your store
  • what they have added to their baskets.

This is just a small selection of what’s available however; there is a really wide range of reports in the tool, and Google Analytics lets you filter your data and visualize the specific data sets you need. It’s well worth integrating it with your Shopify store, even if you’re happy with the platform’s built-in reporting features — Google Analytics can give you a lot of additional context about your users.

Website events report in Google Analytics.
A Google Analytics report on specific website events

Right, let’s get to it.

How to set up Google Analytics 4 in Shopify

1. Create a Google account

In order to use Google Analytics you need to have a Google account.

(If you already have a Gmail account or a Google Workspace account, you’re all set and can jump ahead to step 2 now.)

If you don’t have any kind of Google account yet, you’ll need to go to the Google account sign-up page.

You simply enter your details into the fields provided and click ‘Next’.

The Google account creation page.
The Google account creation page

Note that you don’t need a Gmail address to create a Google account. Google gives you the option to use an email address with another provider, such as Yahoo or Outlook.

You’ll then need to provide some additional information to Google, such as your phone number and a recovery email address for your account. You’ll also need to accept Google’s terms of service.

With that done, you’ll be brought to your new Google account page.

Google account page.
Google account page

2. Set up Analytics and get your tracking code

To set up a Google Analytics account, sign in to Google Analytics.

When you do this, you’ll see a blue ‘Start measuring‘ button in the middle of the Analytics welcome page.

Google Analytics page displaying the 'start measuring' button.
The first step in the Google Analytics setup process

Click on this button.

You’ll then be taken to the Google Analytics account setup screen.

The first thing you need to do is enter an account name for your Google Analytics account. It is usually best to simply go with the name of your business for this.

Naming your Google Analytics account.
Naming your Google Analytics account

You can then choose the type of data you wish to share with Google.

Having done that, click ‘Next.’

You’ll now see the ‘Property setup‘ section.

Tip: In Google terminology, a ‘property’ is essentially all the data associated with an individual website with a unique URL, for example ‘puregrains.com’. If you have multiple websites for your online business, you can set up multiple properties top to track customer behavior on each one.

(In this post I’ll stick to showing you how to enable Google Analytics tracking on a single Shopify website.)

Enter the name of your business in the ‘property name’ field and choose your preferred time zone and currency. Then, click ‘Next‘.

Entering 'property' details in google Analytics.
Entering ‘property’ details

You now have the option to enter some information about your business, such as your industry, company size and how you intend to use Google Analytics.

(You can skip this step if you wish.)

Next, click ‘Create‘.

At this point you need to accept Google’s terms of service for using Google Analytics.

Make sure that you select your country / region in the top left corner of the panel.

Google Analytics Terms of Service Agreement.
Google Analytics Terms of Service Agreement

If your business is located in the EU (or some of your customers are located there), you’ll also need to tick the check box beside ‘I also accept the Data Processing Terms as required by GDPR’. 

Once you’ve done that, click ‘I Accept‘.

You’ll now be brought to the Admin page of your Google Analytics account for your new property.

The Google Analytics property Admin page.
The Google Analytics property Admin page

Go to the ‘Choose a platform‘ section, and click on the ‘Web‘ button.

Choosing the platform type in Google Analytics.
Choosing a platform

You’ll then see a page that lets you create a ‘data stream’ between Google Analytics and your Shopify store.

Google Analytics web stream creation page.
Google Analytics web stream creation page

You now need to enter your store’s domain into the ‘website URL‘ field.

Note: in the below example, we’re using a ‘myshopify.com’ domain. However, you will probably be using a custom domain name (yoursitename.com etc.).

Then enter your business name into the ‘Stream name’ box

Completing the web stream section in google Analytics.
Completing the web stream section in google Analytics

Then click ‘Create stream’.

When you create a new stream, make sure you take a note of the stream’s ‘Measurement ID’ because you’ll need this in the next step.

Google Analytics Stream 'Measurement ID'.
Google Analytics Stream ‘Measurement ID’

3. Add Google Analytics 4 tags to Shopify

At this point, return to your Shopify Admin and click on Online Store > Preferences.

In the Google Analytics section, click on the ‘Manage pixel here’ button.

Manage pixel here button
‘Manage pixel here’ button in Shopify

If you haven’t already added the Google Sales Channel — now called ‘Google & YouTube’ — to your Shopify store, you’ll be prompted to do this now. Simply click on the ‘Install’ button to add it to your Shopify store.

Adding the Google sales channel to a Shopify store
Adding the Google sales channel to a Shopify store

Following that, click on the ‘Connect’ button and choose the Google account you wish to use in conjunction with your Shopify store.

Connecting a Google account.
Connecting a Google account.

You’ll now see the option to ‘connect a Google Analytics property’. In the dropdown menu, select the property you just set up over in Google Analytics, making sure that the ‘Measurement ID’ matches the one you made a note of in Google Analytics.

Selecting a Google Analytics property within the Shopify Admin.
Selecting a Google Analytics property within the Shopify Admin

With the correct property selected, click ‘Connect’.

Congratulations — you’ve just enabled Google Analytics on your Shopify store!

Google Analytics 4 success message in Shopify.
Shopify shows you a success message to confirm that Google Analytics 4 has been set up on your store

But you’re not quite done yet. You’ve still got to…

4. Test that Google Analytics 4 is connected to your Shopify store

Now that you’ve completed all the necessary steps to connect Google Analytics 4 to your Shopify store, it’s time to test that everything is working as it should.

To do this, you can simply enter your store domain name into a web browser.

Browse some of your store pages and interact with your store for a few seconds. This will create some data on your Shopify store that Google Analytics will gather through the connection you have just set up.

Then, go back to Google Analytics and click on ‘Real-time’ in the Google Analytics menu.

This will show you some information on current store visitors as well as visits in the last 30 minutes.

Google Analytics 'real-time overview'.
Google Analytics data showing you a ‘real-time overview’ of site visitors

If you see anything like the image above, you’ll know that Google Analytics 4 is now successfully connected to your Shopify store and gathering data on your customers’ behavior across your store’s pages.

And that’s it!

I hope you find this explanation of how to enable Google Analytics on your Shopify store useful.

If you’ve got any questions, please feel free to add them to the comments section below — we read them all and will do our best to help.

While you’re here, download our free ecommerce e-kit

For a limited time, we’re offering our readers some excellent free tools. Sign up free to immediately receive:

  • our online store comparison chart
  • a downloadable cheatsheet on how to create an online store
  • our SEO, blogging and ‘how to start a business’ cheatsheets
  • extended free trials and discount codes for essential business apps
  • our latest tips on ecommerce and growing a business
  • This field is for validation purposes and should be left unchanged.

View privacy notice.

No comments

Your email address will not be published. Required fields are marked *