Google Analytics 4 (GA4) is currently not a replacement for Google Analytics Universal (GA3). GA4 is data driven and creates a different set of reports. While GA3 collects data based on sessions and pageviews, GA4 collects data based on events and parameters.
GA4 allows you to automatically track events based on enhanced measurements.
However as of writing, for eCommerce tracking, GA3 provides more data compared to GA4.
Shopify currently does not have a solution for adding Google Analytics 4 by default. We will install it manually for all pages, including the checkout. This installation is possible for all Shopify subscription plans.
Requirements
- Access to Google Analytics (admin)
- Access to Shopify > Online Store > Preferences
- Access to Shopify > Online Store > Themes > checkout.liquid
- Access to Shopify > Settings > Checkout
- Access to Google Tag Manager (admin)
Step 1 Get Your GA4 Code
Log in to your Google Analytics account and select your default property.
Click on Admin in the bottom left corner and select GA4 Setup Assistant under property.
Click on Get Started
Create your new GA4 Property by clicking create.
Click on See Your GA4 Property and a new tab will open.
Click on Tag Installation.
Click on your property underneath all data streams.
Copy your Google Analytics 4 Measurement ID in the top right corner paste in a file for later use or keep this tab open.
Step 2 Install & Setup Google Tag Manager
Log in to Google Tag Manager. If you don’t have an account, create one using the steps below. If you already have an account skip these steps.
Create your account and enter all the details with the target platform Web selected. When you click on create, accept the terms and conditions.
Now a popup will appear with the tag installation codes. If you have already closed this or have not yet installed it, you can find the code by going to Admin > click on Install Google Tag Manager. (Keep this tab open for use later)
Before installing Google Tag Manager, we need to install Google Analytics Universal code if you have not done this yet.
Step 3 Install Google Analytics and Google Tag Manager
You can skip this step if you have already done so.
Go to Google Analytics (Select your normal Universal Analytics account) > Admin > Tracking Info > Tracking Code
Copy your GTAG, go to Shopify > Online Store > Preferences, paste your code in the Google Analytics section, and click on save.
Once saved, reload the page and click on add custom javascript, and if not yet enabled, also enable enhanced eCommerce.
Now open your Google Tag Manager tab again and copy the code in the head section between opening script and closing script tag, as highlighted in the image below.
You can ignore the body tag. The iframe tag is only for users that have javascript disabled. This is because the percentage of users with javascript disabled is so low, and when disabled, in most cases, users can not navigate your website as it uses javascript to function.
Paste your code in Shopify and Save.
Go back to Google Tag Manager and copy the head code.
In Shopify, navigate to Online Store > Themes > checkout.liquid and paste your code in the head section.
In Shopify, navigate to Settings > Checkout > Order Status Page and paste your code.
Step 4 Install Google Analytics 4 In Shopify Using Tag Manager
In Google Tag Manager, click on Workspace > Overview > Add New Tag
Click on Tag Configuration
Select Google Analytics GA4 Configuration
Now copy your Google Analytics 4 Measurement ID and paste it in Google Tag Manager.
Now click on Trigger and choose all pages.
Click on Save and keep the renamed tag.
Before the code is live, we need to submit it by clicking on submit in the top right corner.
Give it a name and description and click on Publish.
Within 24 hours your data will start flowing in Google Analytics.
Ecommerce Event Tracking
If you want to track events when users enter your websites, such as tracking product landing page info and purchase data, then you can use Google & Youtube app, and only enable the GA4 setup. (If you don’t want to use the data feed features)
Change Log
- V3 – 26 April 2022 – Added steps to install GTM tag in the checkout thank you page.
- V2 – 15 August 2021 – Improved The Setup For All Pages, Suggested By Adam Gorecki
Hey,
Can Shopify Basic use GTM?
Why the official document said only Shopify Plus can use GTM?
Yes you can install GTM, just not the checkout, for that you need checkout.liquid in your theme.
Hi.
I have followed this https://feedarmy.com/kb/adding-adwords-conversion-tracking-to-shopify/ articles of yours.
The conversions are google ads are visible.
The conversions are visible in UA.
But GA4 is not working… I even talked to a google sepcialist and he check that UA and GA4 is connected…but its not working.. so
if i follow this article about gtm conversions.. and do it.. will this mess us my convesrions to google ads.. I mead i have that long code in the shopify check out
If i use gtm based on this article.. i should delete everything else about ga4? from the theme.liquid and the checkout script?
Thank you
Szandra
To add eCommerce data for Shopify in Google Analytics 4, I recommend using the Google Shopping & Youtube App, which you can find in the Shopify app marketplace.
Hi, it says “This installation is possible for all Shopify subscription plans.”
However Checkout.liquid is only available to Shopify Plus accounts?
Do non Shopify Plus users just skip this step?
Hello Stephen, that is correct.
Thanks!
There is no checkout liquid in my shopify store, what should I do?
If you want checkout.liquid, you need to contact Shopify to add it.
Hello, I have pasted the global site tag in the theme of shopify, but there is no conversion tracking event (checkout) in GA4, and I also set up ads enhanced conversion, what should I do? thank you very much
I recommend installing Google Ads conversion action instead: https://feedarmy.com/kb/adding-adwords-conversion-tracking-to-shopify/
By Doing this will conversions record in google ads or i have to do something else?
This is a tutorial to install Google Analytics 4 and also to resolve the global site tag, not conversion tracking directly. If you want to install conversion tracking and want to also include enhanced conversions, follow this guide: https://feedarmy.com/kb/adding-adwords-conversion-tracking-to-shopify/
Thank You! – So detailed & easy to follow. For someone non technical it is Impossible! to figure this out on mu own – Much Appreciated 🙂
Pleasure! 🙂
How long does it usually take for Google ads to recognise the changes made? I changed as per your instructions yesterday, however it is still showing the ‘Make sure that you don’t miss any conversions by fixing your global site tag issues ‘ – Thanks!
If you have an issue with misconfiguration on your shopping campaign, this is related to conversion tracking and remarketing. Not GA4.
Hi Emmanuel – the error I got was “Fix your global site tag issues” followed by “Over 10% of your pages do not have gtag.js or a Google Tag Manager tag” – I googled it and came across your article that I implemented – so it wasn’t the correct solution? thanks
This tutorial will indeed resolve the Global Tag issue. But as if you are tracking conversion using Google Ads natively, then there will be no lost conversions. Unless you can not track enhanced conversions. If you also like to enable that, here is the guide: https://feedarmy.com/kb/adding-adwords-conversion-tracking-to-shopify/
Thank you! Appreciate it – my Google ads are still showing the fix your global tag issue it’s been 3 days – so does it take a few days for Google to update and recognise the steps taken . Thanks
If you are referring to recommendations in Google Ads. Sometimes, it does not disappear. And you will need to manually dismiss and flag it as already done outside the recommendations. If you mean in the audience manager, this can take a while. As long as it is installed you can ignore the warning.
Hi there! Just want to confirm if this method of installing the GA4 in Shopify allows you to track the conversions in Analytics. The other methods I see only requires installing the code in the themes, but this doesn’t allow you to track conversions.
Yes, you can if you set it up. However, if you want to track conversions, I recommend setting up with enhanced listings here: https://feedarmy.com/kb/adding-adwords-conversion-tracking-to-shopify/