What Google Analytics 4 (GA4) means for your online Shopify store
Industry Insights, 4th May 2022
In March, Google Analytics announced the inevitable. They're sunsetting the Universal Analytics (UA) branch of its analytics software and from July 2023, it'll be replaced with a more platform-diverse version called Google Analytics 4 (GA4).
Why is Google moving away from Universal Analytics and what benefit will Google Analytics 4 offer?
Google Analytics 4 primarily focuses on privacy to provide a better user experience. Users are increasingly expecting to have greater understanding and control over their own data, and GA4 has been built to handle these demands from the user, as well as be in a better position to facilitate the business needs when collecting data.
Unlike Universal Analytics, Google Analytics 4 doesn't rely solely on cookies to track user data. It uses an event-based model to create new sessions every time a user revisits your site. This gives admins a better understanding of user behaviour and allows them greater control over what their reports focus on. This should mean the ability to dig deeper and report on very specific areas in a way that UA doesn't currently do.
When and how do I replace Universal Analytics?
Even though it's a while before Universal Analytics disappears, it’s within your interest to start using Google Analytics 4 sooner rather than later. GA4 will only start collecting data from the point the 'property' has been created and the tag has been added to your site. If you do it now, you'll have data collected and ready to go when they switch.
Alternatively, you can get going with GA4 straight away. Google has given users the option to upgrade early. To do this, simply login to your account, head to the Property column and click on the Upgrade to GA4 prompt.
Be prepared before you switch
Before making the changeover, we recommend making doubly sure that Google Analytics 4 has implemented all of the features you need. Whilst it's still evolving, in its current state there are some Universal Analytics features missing:
- Complete IP filtering
- Hostname filtering
- Session and product-scoped custom dimensions and metrics
- Data API updates
- Enhanced report filtering and sorting (including regex filters)
- Google Optimize integration
- Recurring email reports
How do I integrate Google Analytics 4 with Shopify?
Assuming you’ve taken the initiative to set up your GA4 property in Google Analytics and have your Shopify site up and running for test transactions at least, you’ll want to take three simple steps to ensure that you're successfully integrating Google Analytics 4 with Shopify.
Step 1: Add the gtag.js code snippet to the theme.liquid file.
Add the gtag.js code snippet to your theme.liquid file so it appears on every page of your site.
You can find this code snippet in your Google Analytics dashboard under Settings > Properties > Data Streams > [Your Chosen Data Stream] > Tagging Instructions.
It will look similar to this:
Step 2: Manage any unwanted checkout and completed transaction referrals.
Ensure the checkout page is not being tracked as a referral when visited and whenever a transaction is completed. You can do this in the same Data Streams panel mentioned previously. Below Tagging Instructions is an option labelled More Tagging Settings. Here you’ll see an option called List Unwanted Referrals wherein you can choose Referral Domain Contains and input "myshopify.com".
Step 3: Add the final gtag.js code snippet to the order confirmation page
Add an additional gtag.js snippet including a purchase event and relevant liquid code to the order confirmation page. You can do this in your Shopify settings panel. Go to Checkout, scroll down the page to Order Status Page and paste the following into the field provided:
Note: This will require testing depending on the set-up of your store and its products.
Implementing these three simple steps allows Google Analytics 4 to process your customers' purchases with the correct marketing attribution as accurately as you would expect, but it’s really the second step that’s doing all of the heavy lifting.
How does GA4's integration with Shopify work?
Due to the way Shopify processes transactions in their secure checkout environment (even with a Shopify Plus account), the user journey that began when they landed on your site ends when they leave for your secure checkout.
As a result, Google Analytics 4 determines that a user's journey ended at the point the user visited your checkout page. (This prevents a snippet in checkout.liquid from bridging the gap for you Shopify Plus people!).
So how does adding a purchase event to your order confirmation page help? On its own it doesn’t. It would leave you with a slew of purchases all being attributed as referrals from Shopify, which isn’t the level of granular attribution you’re using Google Analytics 4 for!
It’s the second step, that tells GA4 not to count those referrals from the secure checkout environment that enables you to get the correct user journey attribution. This is because GA4 will count those multiple sessions as a multi-touchpoint user journey, and as long as you’re not throwing erroneous referrals in, your results should show which traffic channels are leading to a purchase.
For more, watch this video provided by our friends over at LOVES DATA that runs through this process step-by-step.
Like what you see? Help others discover this article.
As a sustainable Shopify development agency, we are passionate about educating and informing businesses about the importance of reducing their online carbon footprint. If you found this post insightful, please consider sharing it with your followers to help us spread this knowledge and inspire others to join us in this important mission.