On the 1st of July 2023 Google Universal Analytics (UA) properties will stop processing data. Instead you'll need to create a Google Analytics 4 (GA4) property for your sites to use.
Fortunately, the Google tag script (ie the snippet output in the page source) used by GA4 is the same as the gtag.js script used by the most recent UA properties. That means, once you have created your new GA4 property and generated your Measurement ID (which starts G-), you can update your subsite settings and start tracking straight away.
This article gives a brief overview of the process and links to Google's own documentation.
Before you start
To be able to move (fairly) seamlessly to GA4, your sites will need to be using at least version 18 of the iCM.NET or iCM4j frameworks, released in December 2021. These releases introduced the gtag.js tracking snippet.
If you look at your site's page source and can see a line similar to this:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-109060414-1"></script>
you are on a compatible version. If not, you'll need to be updated to a more recent release - contact support or your account manager.
What's changed in the GOSS platform?
To be honest, nothing!
If you're using Google Analytics, you'll currently have your UA Tracking ID in your subsite settings:
To switch to GA4, replace the old Tracking ID with the new Measurement ID:
That's all that needs to happen in iCM for your site to use GA4.
Creating a GA4 property
Updating things in iCM is the easy part. While updating this Docs website to use GA4, I found Google's documentation a bit spidery and hard to follow, so have put together the following overview.
Use their tool
When you log into Google Analytics, you'll see a warning banner which prompts you to create a new property.
I recommend pressing "Let's go" and using their setup assistant to create a "connected" property. Google's documentation can be found at https://support.google.com/analytics/answer/9744165
In this screenshot you can see my old Docs property and the new Docs-GA4 one created by the setup assistant:
One thing to note, GA4 has done away with "views" (which you can see in my old property above). If you were using views, there are new features you can use instead https://support.google.com/analytics/answer/10845666
Finding your Measurement ID
I struggled finding my Measurement ID once I'd created it.
The easiest place to see it is to navigate through Admin > Property > Data Streams, then click on the stream in the list. You'll then see your stream details, including the Measurement ID (starting G-) that needs to go into your subsite settings.
Google have an explanation of the different names for the various IDs and where to find them here https://support.google.com/analytics/answer/9539598
Things to consider
As well as updating your site to use GA4, I made the following changes on this website. There are probably more to consider, depending on how extensively you use analytics.
Google Tag Manager
If you are using Google Tag Manager and the Universal Analytics tag, you'll need to create new GA4 tags.
I created a GA4 Configuration tag to hold the Measurement ID (previously the Tracking ID was held in a variable), with a trigger on page initialisation.
I also created a GA4 Event tag, which is used to track video views (more on that below).
This article was useful https://support.google.com/analytics/answer/10270783
Events
GA4 does not use event categories, actions and labels. Instead events have parameters.
What is nice in GA4 is that many events are supported and enabled as standard. In the data stream screenshot above you can see, under "Enhanced measurement" the things GA4 will automatically track for you. It includes use of your site search (including search terms), page views, clicks, scrolling, file downloads and form interactions. It also integrates with any embedded YouTube videos.
There's an overview of events migration in this support article https://support.google.com/analytics/answer/11091422. This one describes what is collected automatically https://support.google.com/analytics/answer/9234069
Videos
Out of the box, GA4 supports tracking video plays for YouTube videos. To work with our inline video player, you will need to implement custom tracking in Google Tag Manager (you would have done this with the previous version of analytics too).
There are several guides online about setting up GTM for video tracking. The most useful tutorials describe HTML5 video tracking in Tag Manager with custom dimensions.