How to Add Google Analytics to Shopify

Disclosure: Some of the links below are affiliate links, meaning, at no additional cost to you, Storehacks may earn a commission if you click a link to an external source.

Google Analytics is a powerful tool. It can tell you how many people are visiting your site, what keywords they are searching for, and even where in the world they are coming from.

But sometimes it's not enough to use Universal Google Analytics alone–you need something more specific to your business. Enter GA4!

In this tutorial I'm going to show you how easy it is to install both Universal Google Analytics and GA4 on your Shopify store so that you have all of the information about your store at your fingertips.

What's the Different Between Universal Analytics and GA4?

Universal Analytics (UA) is actually the “older” version of analytics tracking however, because Shopify doesn't integrate with GA4, you need to use both.

Without getting too technical, because it's not really necessary, UA tracks “hit types” and GA4 tracking is event-based.

All you really need to know is that they both track traffic to your site and give you valuable information on how your users interact.

You can read more on the differences between UA and GA4 here, if you're a bit of a tech head.

Why Do You Need Google Analytics on Your Shopify Store?

There are a few reasons why you might want to add Google Analytics tracking to your Shopify store:

  • To track traffic and “goal conversions” (such as adding products to cart or making a purchase)
  • To see where your users are coming from, what devices they're using, and how long they're staying on your site
  • To see which pages on your site are the most popular and what content is being shared the most
  • To identify any areas of improvement for your store, such as page load time or bounce rate

If you run Facebook Ads then you can get some of this information from your ads manager dashboard, but it's not very accurate and it's always good to compare with Google Analytics data.

You've also probably already worked out that Google Analytics can give you a lot of different stats than Facebook or Shopify themselves do.

How to Add Google Universal Analytics in Shopify

Adding Universal Google Analytics in Shopify is quite easy so we will focus on that first. The next step will cover GA4 because that is a slightly different process because only UA integrates with the Shopify checkout (unless you pay$2k a month for Shopify Plus 😮).

Let's start with setting up a Google Analytics account.

Create a Google Analytics Account

Obviously you need to have created a Google Analytics account first, so just head on over to analytics.google.com and hit “Start Measuring”. You need a Google account to do this, so make sure you have one before starting this tutorial.GA Setup 1

 

Step 1: Enter an account name, leave the checkboxes default (these are optional) and hit Next.

GA Setup 2

Step 2: Enter a property name, which is simply the name of your website. Choose your currency and timezone.

GA Setup 3

Click Advanced Options and make sure the toggle for Create a Universal Analytics Property is on.

Enter your store URL and ensure that the first radio button is selection.

Step 3: You'll be asked some basic questions about your business, these are totally optional. You've now finished the first part of the setup process.

Step 4: Once you're inside your new Google Analytics account, you will see the account and the property (website) that you setup.

GA Setup 4

Making sure that your UA Property is showing at the top of the column, click on Tracking Info and then Tracking Code.

GA Setup 5

Highlight and copy your Tracking ID.

Adding Google Universal Analytics to Shopify

Login to your Shopify store and go to Online Store and then Preferences.

Shopify GA Setup 1

Scroll down to Google Analytics and paste in your UA code that you got from Step 4.

Shopify GA Setup 2Once you do this, make sure the Enhanced Ecommerce box is checked.

Jump back over Google Analytics and select E-commerce Settings from the far right column.

UA Toggle Ecommerce Settings

Switch on both toggles under E-commerce Setup and click save.

Now you've successfully set up and installed Google Universal Analytics on your Shopify store!

How to Setup GA4 on Your Shopify Store

Whilst you can get away without setting up GA4 at this stage, we recommend it because it's Google's “new” version of tracking that will eventually see UA phase out.

Just bear in mind that this requires accessing the code for your store so if you don't feel confident doing this, you can always try hiring someone from UpWork or HeyCarson to do this for you.

Step 1: Go into your Google Analytics dashboard and in the property column, change it over to the GA4 property.

GA4 Setup 1

Step 2: In that same middle column, click Data Streams and then click the arrow on the far right of the URL.

GA4 Setup 2

Step 3: The “Web stream details” screen will appear. Scroll down and click the “Global site tag” dropdown which will reveal the code that you need to put into your Shopify store code.

GA4 Setup 3

Step 4: Copy this code and head over to Shopify. Click Online Store, Themes, then on the right hand side you'll need to select Edit Code from the Actions menu.

GA4 Shopify Setup 1

Step 5: Once in the code editor, select theme.liquid from the left hand menu and then under the <head> tag in the code, paste your Google Analytics GA4 code.

Shopify Google Analytics Code in Header

Click save and now you are done setting up GA4 on your Shopify store!

Your Next Google Analytics & Shopify Challenge

Now you're all setup, you'll need to learn the basics of how to read data that Google Analytics gives you.

I encourage you to explore the Google Analytics dashboard so you can discover more about who your customers are.

Google Analytics dashboard

If you browse through all the menu options on the left you can see all sorts of data for your site.

Google also has a great range of free courses in their Analytics Academy to help you get the most out of all the data.

I also highly recommend you join our free Storehacks Facebook community if you have questions about Google Analytics or any other ecommerce related topics. We're over 5,000 strong and just love supporting our fellow ecommerce sellers!

Related Stories

LEAVE A REPLY

Please enter your comment!
Please enter your name here