Google has recently announced that Universal Analytics will be retiring and that Google Analytics 4 (GA4) will take over.
If your website is built in WooCommerce (WordPress’ eCommerce platform) there’s a big chance you are currently running Universal Analytics on it.
Ideally, you would have GA4 running alongside Universal Analytics for a while. It will give you some time to get used to the new GA4 interface. That way, you can collect data in your new GA4 property while still analysing and using Universal Analytics.
Well, at least until mid-2023 when Google is forcing us to use GA4 only.
What is GA4?
Google Analytics 4 is a complete update of the Google Analytics system which Google has been working on for years. In general, it will give a user more flexibility to track things the way that is useful for them rather than using page views as the main guidance.
I won’t get too deep into this, as there are other blog posts written that really breaks it down into details(including this one from Ken Williams).
Setting up GA4 for WooCommerce
If you are using Universal Analytics for your WooCommerce store, you would want to set up Google Analytics 4 ASAP. That way, you will be receiving all the data and once you are familiar with the platform you can start using GA4 instead of Universal Analytics.
There’s a big chance that you are currently using a plugin for Google Analytics (eg. “WooCommerce Google Analytics Integration”). Which is a great option, as it pushes through all the ecommerce data (order, order value etc.) automatically. However, at today’s date (May 2022) it doesn’t give the option to run 2 GA codes alongside each other.
The alternative? You will have to fire the GA4 code via Google Tag Manager. This will give you the option to run both Universal Analytics and Google Analytics 4.
Don’t worry, I will run you through the steps to set this up.
Step 1: Install Google Tag Manager to WordPress
If you aren’t running GTM already, you will have to install this to WordPress.
We wrote another article on how to easily do this. If you follow option 3 in our “3 Ways To Install Google Analytics To Your WordPress Website” article you can add GTM to your website by using the ‘Insert Headers and Footers’ plugin. Otherwise, you have the option to add GTM to your website in step 2.
Step 2: Add Ecommerce variables, triggers and tags to GTM
This could take up a lot of time. Luckily, there is a free WordPress plugin that can do this for you automatically.
Find the plugin “Google Tag Manager for WooCommerce FREE” and install this to your WordPress website. Now, there is a paid version for this plugin which pushes through additional values. The free version will push through add_to_cart and purchases which might be enough for you. If not, got for the paid version instead.
The plugin will give you the option to insert the GTM code directly, or otherwise install it another way. If you have already installed GTM another way, select “Yes, I inject GTM snippets differently” to the “Prevent loading GTM Snippet?” question.
Then, the plugin will give you the option to download a file with the preset variables, triggers and tags. You will need to download this file and install it to your Google Tag Manager account.
Go to the “GTM presets” tab and download the “Google Analytics 4 (Basic)” package.
This will download a JSON file to your computer.
Then, head to your GTM container admin area and click “Import Container”.
You can choose to either overwrite your container or merge it with the details. In most cases, you would want to merge it with your existing container.
As the last step, you will need to update the GA Measurement ID to your own unique GA4 tracking ID. Head to “Variables” in the left-hand menu and scroll down to “GA4 Measurement ID”.
Update this to your own GA4 tracking ID, which starts with “G-”
Don’t forget to publish your GTM changes!
Step 3: Watch the data come into your GA4 account
These changes will fire off the GA4 code on your WooCommerce website, along with the basic eCommerce data.
Give it a few days and see if the revenue data in your GA4 account will match the data in Universal Analytics.
This will make sure that you run your new GA4 account next to your Universal Analytics.
The data in Universal Analytics will still be populated and you can use this when running your WooCommerce business. In the meanwhile, your Google Analytics 4 account will start collecting data giving you more than enough time to get used to all the changes.