Google Analytics 4 is the newest version of Google's ultra-popular tracking platform.
Google is encouraging users to move to this new version of the platform in the next few months. This is because the older version, called Universal Analytics, will stop working in the summer of 2023, and it not backward-compatible. This post has more background on the new Google Analytics 4.
So, if you want to keep using Google Analytics, you will need to actively update your sites in the next year.
We've heard from Joomla users who plan to run both Google Analytics 4 and Universal Analytics on their site at the same time. This is a perfectly valid approach, and will make for a smooth handover. In this guide, I'll show you how to run both versions on your site.
PS. If you don't want to use Google Analytics at all, Joomlashack still has you covered!
How to Use Multiple Versions of Google Analytics
For this tutorial, we'll use Shack Analytics, which is a single extension to manage all the analytics code on your sites.
To get started with this process, go to https://analytics.google.com and get both versions of the code for your site.
Your Universal Analytics will probably already be installed on your site, and it will look like the code in this image below:
Your Google Analytics 4 code will look like this next image:
Now that you have copies of both versions of your Google Analytics code, you can install them on your site.
- Install Shack Analytics on your site.
- Go to Components > Shack Analytics > System - Shack Analytics.
- On this screen you can choose either Universal or Google Analytics 4. In this example, I'm choosing Universal.
- Enter the property ID and click "Save".
Our next step will be to add the second, alternative tag. We're going to take a look at the main screen in Shack Analytics. Honestly, you could add both versions of Google Analytics into this area. This part of Shack Analytics is designed to hold all your analytics tags.
- Go to Components > Shack Analytics > Tracking Tags.
- Click "New".
- Add the full code to a tracking tag. I would recommend entering the code into the "Footer Script" area so it loads at the bottom of your site.
- Click "Save & Close".
- Click "Options" from the main Shack Analytics screen.
- Set your new option as a Global Tracking Tag.
To complete the process, go to the frontend of your site. Check the source code of your site to make sure that both of your Google Analytics codes are loading. Finally, make a note to check Google Analytics again tomorrow to make sure that your traffic is being correctly recorded.