Shopify / Marketing / Shopify Tutorials / Tutorials

How To Add Universal Google Analytics & GA4 To Shopify

Add google analytics to shopify
Published 29 April 2022

Updated 29th April 2022

Google Analytics is a very powerful tool for your online store, and you need to have it properly set up. Besides giving you information about your website’s stats, you can also see what pages are performing best, what your rankings are, and of course, how people find your website.

By knowing what pages are performing better, where your visitors are and how they interact with your website, you have all the tools you need to optimize your marketing funnel and improve your conversion rates.

Why You Need Google Analytics?

1. Measure the effectiveness of your campaigns

You need to know if your ad campaigns are reaching the right audience, and by paying close attention to your analytics, you can figure out data about your visitor’s location, the way they found your website, and the time they spend on your website. Above everything, you can also find out what their interests are.

2. Improve your conversion rates

In your analytics menu, you will be able to see what your bounce rates are and make a plan to improve them. In general, high bounce rates mean that your visitors didn’t find what they needed, so you need to work on the quality of your content. 

3. See what your visitors are looking for

Using the “Site Search” tab on your Google Analytics screen, you can find out what people are searching for, how many of them searched for the same thing, and how many unique searches you had in a specific time frame. This can help you create targeted content for your visitors, and your conversion rates will improve. 

4. Have access to real-time stats

The best thing about Google Analytics is the fact that you can see who is visiting your website in real-time. This can help you get an idea of where your visitors live and what are the times they interact with your website. By sending ad campaigns in that timeframe, you can increase the number of people entering your marketing funnel. 

Of course, you need to use Google Analytics along with your Shopify store. Even though all the codes may lead you to think that it’s a hard process, it’s actually very easy thanks to the integrations Shopify is offering. 

We suggest installing both Universal & GA4

Google use the old version (Universal Analytics) & the new version released in 2020 (GA4).

Both versions should be installed with Shopify but Universal is more important currently. The universal method is integrated into checkout pages by Shopify’s built-in GA system.

GA4 unfortunately has not been integrated into Shopify’s platform yet, so we need to install this manually into the code templates, BUT it cannot track ecommerce information on checkout pages. This is why we suggest always installing both versions as the old Universal version tracks the checkout ecommerce pages & information.

Universal Google Analytics is the most important for Shopify currently, GA4 is the second priority.

Universal AnalyticsGoogle Analytics 4 (GA4)
Older version of Analytics that has a native integration into Shopify’s platform which tracks checkout pages.The new version of analytics since Q4 2020. The only problem currently with this version is Shopify have not created a native integration method for this.
Shopify blocks access to checkout pages unless you have the Shopify Plus plan, which costs around $2000/month. So this means when you install code into the theme.liquid file, you cannot track checkout pages.
Ga4 shopify
Notice from Shopify’s website

I hope Shopify integrate GA4 soon because Google has announced that they are discontinuing Universal Analytics in 2023. As soon as I get an update, I will update this article.

How to add “Universal Google Analytics” to Shopify

1. Create your Universal Google Analytics code if you haven’t yet

Skip to number 2 if you have a universal code already.

Go to the gear icon “Admin” in the bottom left. Then “Create Property“.

Universal create 1 1

Click “Show advanced options“. This will open up the section to create a universal property.

Universal create 2 1

Enter your website domain. If you haven’t created a Google Analytics 4 property yet, you can keep the first bullet point selected where it says “create both a Google Analytics 4 and a Universal Analytics property“.

If you have already created a GA4 property, then select the second bullet point saying ” Create a Universal property only“.

Universal create 3 1

2. Find your Universal Google Analytics code

  1. After setting up your Universal property, you will want to go to your Google Analytics dashboard.
  2. Click on “All Web Site Data” and make sure you have selected the UA property. The code begins with “UA” for Universal Analytics.
Select all web
Select ua analytics
  1. Next, find your “Admin” button in the bottom left.
  2. From there, click on “Tracking info”, where another menu will open. Next, you will want to open the “Tracking code” tab and copy your ID.

Please make sure you have selected the Universal Analytics property for this. If the tracking info doesn’t show, you are not in the Universal property.

Add google analytics to shopify

3. Add your tracking ID to Shopify & enable Ecommerce

Open a new tab or window then go to the Shopify dashboard and open the “Preferences” tab.

Shopify, preferences select

You need to add your Google Analytics Tracking ID (example – UA-00000000-0) to the Shopify “Google Analytics account” field shown below. Your universal ID always begins with UA.

In Q3 2021, Shopify seems to have written “You must upgrade to the latest version of Google Analytics in order to use Enhanced Ecommerce.” This doesn’t make sense because they still only accept the old universal analytics. Just place the universal analytics code in there and you will be able to enable enhanced eCommerce.

Then tick the “Use enhanced ecommerce” setting and click save.

Add google analytics to shopify

4. Enable Ecommerce Tracking in Google Analytics

  1. In this step, you need to return to the Admin screen of your Google Analytics console and click on “Ecommerce Settings”. 
Set up google analytics with shopify
  1. This step is very straightforward and you only need to move the slider from “Off” to “On,” and then save your settings.
Enable ecommerce tracking

After completing this step, you can go back to step 2 and enable the “Use Enhanced Ecommerce” box under your tracking ID. 

How to add “Google Analytics 4” to Shopify

1. Open the GA4 Assistant

If you have already created the GA4 property in the Universal Analytics steps above then skip to step 5.

From Google Analytics, go to “Admin” and select “GA4 Setup Assistant“.

Add ga4 to shopify

2. Create a New GA4 Property

When you reach the setup menu, you’ll need to create a new GA4 property.

Untitled 3

3. Complete the Setup Process

Click the “Create Property” button.

Add ga4 to shopify 3

4. Open Your GA4 Property

Add ga4 to shopify 4 1

5. Access the Tag Installation Tab

You need to click on the “Tag installation” tab in order to get your code and add it to Shopify.

Add ga4 to shopify 5

If you have skipped to 5. from 1. because you already have GA4:

If you can’t find this section in the analytics dashboard, go to “Admin“, then go to the drop-down under “Property” and choose your GA4 property. GA4 properties DO NOT begin with UA.


Then click on “Setup Assistant“. You will find the tag installation instructions in here.


6. Select Your Property

Data stream

7. Copy Your Global Site Tag

Use the copy button in the top right corner.

Global site tag

8. Open the Shopify Theme Code

Open up your Shopify dashboard in a new tab or window.

Edit code

9. Add the GA4 Tag in Your Store’s Code

You need to paste the GA4 analytics code underneath <head>, otherwise, it won’t work. Remember to hit the save button when you’re done.


Even though it’s very easy to add Google Analytics to Shopify, Google Analytics 4 is a little more complicated. Hopefully, we’ll have full support for it in the near future.


About Author

Will is a professional Ecommerce Shopify expert (7 years experience) & a professional Filmmaker/Video Editor (17 years experience). Now living between the Isle of Man & Brighton, UK. Highly experienced in Premiere Pro, DaVinci Resolve, After Effects, Shopify, WordPress & SEO. Owner of Teckers, Bounce Color, Stunt Camera Crew & more.


  • omer
    14 April 2021 at 11:44 am

    Can you install both universal analytics and GA4 in the same website in shopify?

    • Will Sutton
      14 April 2021 at 9:25 pm

      Yes you can. Shopify has a UA native entry in the settings & you can install both versions in the theme code.

    • Will Sutton
      25 August 2021 at 9:10 am

      Yes you can

  • Wade
    7 June 2021 at 8:49 pm

    Very well written and help! Thank you!

  • jorge aguayo
    29 June 2021 at 8:07 pm

    Hey! thanks! as far as I understand it helps to all the website, except the checkout section, can you please clarify?


    • Will Sutton
      30 June 2021 at 12:12 pm

      Yes that’s right, as far as we are aware up to now, it’s only possible to track the checkout with Universal Analytics due to Shopify not implementing GA4 yet. Hopefully they will make it possible to track checkout with GA4 soon.

  • Tony
    11 July 2021 at 4:43 am

    This is what the GA entry area of Shopify now says:

    Google Analytics account (how do I set this up?)
    Paste your code from Google here

    Enhanced Ecommerce
    You must upgrade to the latest version of Google Analytics in order to use Enhanced Ecommerce.

    Does that mean it’s only GA4 now in Shopify going forwards? Even Shopify’s own docs contradict itself on this.

    • Will Sutton
      14 July 2021 at 6:21 pm

      It seems they are contradicting themselves. I have tested it and they only seem to accept UA analytics still (Old version). So you need to paste the UA code in to use enhanced eCommerce, not GA4. I don’t understand why they have said “the latest version”.

  • Cedric Gunz
    5 August 2021 at 10:09 am

    Thank you very much!! Really nice manual!

  • Ryan
    28 November 2021 at 3:57 pm

    Finalllyyyyyy, lol. The actual “How do I set this up?” instructions on the Shopify help page are horrible… And I swear, all recent YouTube videos ONLY talk about the new GA4 analytics code, not also installing the old code. This helped a lot.

  • Linou
    24 April 2022 at 9:12 pm

    Thank you very much for your help and detailed step by step! I really appreciated it and could install both GA.

  • Brad W
    28 July 2022 at 10:08 am

    Thanks for the article! Any news on when/if Shopify will be integrating GA4 yet?

    I’m tempted to hold off on adding GA4 until the integration – unless you think I’m missing out massively by waiting?

    • Will Sutton
      29 July 2022 at 9:38 am

      No news as of yet. They are taking their time with it! I hope soon though because we all don’t want to change last minute. It might be worth adding it via code for now, then at least you have collected to history


Leave a Reply