GA4 is the new (and quite different) Google Analytics, replacing the longstanding Univeral Analytics (or GA3). This step-by-step tutorial will guide you through the process of configuring GA4 across your websites and mobile apps.
GA4 improves on some of the limitations of UA around conversion funnels and other reporting challenges, although it isn't yet able to match the range of reporting tools and complex features of its older brother. As such, it may not yet be the go-to analytics reporting tool for every organisation. However, with Google announcing the sunsetting of Universal Analytics from 1 July 2023, it's important to get set up with GA4 and to start collecting data sooner rather than later to ensure that you can report over as wide a date range as possible when you do decide to transition.
Setting up the basic configuration and tracking for GA4 is a pretty straightforward process, especially when you add it to your site via Google Tag Manager (GTM). Follow this step-by-step guide to configure GA4 for your websites, whether you're already using Universal Analytics or are starting from scratch.
- Step 1 – Create a GA4 property
- Step 2 – Create data streams
- Step 3 – Add to Google Tag Manager (GTM)
- Step 4 – Link to Google Search Console (optional)
It's worth running through all of the steps in this tutorial (including GTM setup) for your staging sites first, and then once you've tested everything is working as expected and the data is pulling through to GA4, running back through all of the steps for your live sites.
Why should I set up GA4?
Google's Universal Analytics (or GA3) – the version of Google Analytics that we're all used to – is being sunset on 1 July 2023. In addition to no longer being able to use the platform from that date, you'll also no longer have access to the reporting or data that you've collected over the years.
Can I continue to track Universal Analytics after setting up GA4?
You can indeed, and we'd recommend it! If you're already using Universal Analytics (the version of analytics that's being discontinued), you can continue to use it alongside GA4. If your Universal Analytics has been set up in Google Tag Manager (GTM), the steps to configure GA4 (below) are exactly the same regardless of whether you're currently using Universal Analytics or are about to use Google Analytics for the very first time.
Step 1 – Create a GA4 property
Properties exist in same part of Google Analytics as the Universal Analytics properties you already have. Hit the Admin button in the bottom right-hand corner of the screen, and then Create property. When given the option, choose GA4 for your new property.
Choose a name
For my properties I've included the name of my organisation and either 'staging' or 'live' in brackets. My two properties are therefore Objectively Digital (staging) for my staging sites, and for my live websites a separate property titled Objectively Digital (live).
Set the time zone
This is the time zone that will be used in reporting. Unless your organisation is operating primarily in a different country to that which you're based, this should be your own time zone. If you're in the UK, note that when you select United Kingdom the time zone often defaults to GMT – make sure you amend to United Kingdom Time to take into account seasonal clock changes. And note that if you choose the wrong time zone, updating this more than once in the same day can lead to errors.
Hit Continue. You may be asked for some more details about your organisation. When you're ready, hit Create. Next it's time to configure the data streams for this property.
Step 2 – Create data streams
Choose a platform
Choose the relevant platform for your data stream – in most cases this will be Web. If you have native mobile apps (i.e. for iOS or Android) you should set these up as separate data streams and choose the relevant platform for each. In this tutorial we're going to run through the process for configuring GA4 to track users across our websites, but the steps are broadly the same for mobile apps.
As a general rule, most organisations will only need one property and one data stream. Having separate data streams for different websites limits your ability to report on user behaviour across these websites, so where possible it's usually best to track them all in a single data stream. For the full low-down on how to structure your properties and data streams and why, check out this article: How should I structure my Google Analytics 4 properties and data streams?
Specify a website URL
This should be the URL for your main marketing site; don't worry at this point if you're planning to track other websites too (e.g. your online shop or ticketing purchase pathway) – we'll get to this later. If your website uses the www subdomain, it's a good idea to include this in the URL (e.g. www.mytheatre.com).
In most cases it's best practice to redirect either your root domain (e.g. mytheatre.com) to a www subdomain (e.g. www.mywebsite.com), or vice versa. This keeps your analytics data consistent, ensuring that your host name dimension doesn't vary depending on whether a user typed in www. at the beginning of the URL or not. You can check whether your website is redirecting by visiting yourwebsite.com and seeing whether the www. automatically appears in the URL bar (note that you may need to click on the URL bar to display the www. as most web browsers hide it), and vice versa. It's likely a redirect will already be in place for your website, but if not, talk to your website developers. Note that there may be a particular reason why a redirect won't be possible for your website.
Give your stream a name
Choose a meaningful name for your stream. You'll likely have already included your organisation name in the name for your property, so you don't need to include it again here unless you'd prefer to. In my case I've gone for 'websites' followed by either 'staging' or 'live' in brackets (e.g. Websites (staging)).
Once you're ready, hit Create.
Make sure 'enhanced measurement' is enabled
Enhanced measurement is a shortcut that automatically tracks a series of common interactions, including page views, scrolls, clicks through to other websites, internal site searches, video interactions, and downloads. This is one of the features that sets GA4 apart from Universal Analytics – the ease with which you can track these types of events out-of-the-box.
For the full low-down of what enhanced measurement tracks, take a look at this article: [GA4] Enhanced measurement events.
Next it's time to add the tag to your website(s) via GTM that will send the visit and interaction data to GA4. Make a note of the Measurement ID for your data stream – this is the unique identifier for the data stream that we'll use to send data to the right place. The Stream ID is another unique identifier for the data stream but is only really useful for internal admin purposes.
Step 3 – Add to Google Tag Manager (GTM)
There are two GA4 tag templates in GTM – GA4 Configuration and GA4 Event. The GA4 Configuration tag loads the code that GA4 needs to be able to identify interactions and pass data back to your properties. If you enabled enhanced measurement it will start tracking page views, scrolls and other events automatically without you having to configure separate GA4 Event tags for these. The GA4 Event tags enable you to track other more custom events, like making a purchase, or submitting a contact form.
If you want to track conversions on your website you'll need to configure the necessary GA4 Event tags. The steps to do this vary depending on your ticketing or eCommerce system so we'll cover this in another article.
You'll need to set up a GA4 Configuration tag before you can set up any GA4 Event tags (e.g. to track conversions). A GA4 Configuration tag needs to be associated with a data stream using the Measurement ID for the stream. As we'll be using the same data stream across all of our websites we'll only need to create one GA4 Configuration tag, but we'll configure separate triggers for each of the websites (and for staging vs live) for that tag.
First, let's make sure we have the right triggers. If you've been using GTM for a while it's quite likely you'll already have these set up. If not, here are the steps.
You should create a separate trigger for each environment, for each of your websites. I only have one website, so in my case I'm going to create just two triggers: one titled All Pages (staging) and another titled All Pages (live). If you have multiple websites (e.g. a main marketing site and separate shop site) you should create separate triggers for these. You might title these something like Main Website – All Pages (staging) and Shop – All Pages (staging).
To create a trigger:
- Click Triggers in the left-hand navigation menu and hit New.
- Specify a title (as above).
- Choose Page View as the Trigger Type.
- Change This trigger fires on to Some Page Views.
- Select Page Hostname as the variable, equals as the operator, and enter the hostname of the site you're configuring the trigger for (e.g. staging.mytheatre.com). It's particularly important to use equals as the operator if your shop or other sites are accessed via a subdomain of your main website domain (e.g. shop.mytheatre.com). If you used contains the trigger for your main website (e.g. mytheatre.com) will also fire for your shop site.
- Hit Save.
Create a GA4 Configuration tag
Once you've set up all the triggers you need, it's time to create the GA4 Configuration tag:
- Click Tags in the left-hand navigation menu and hit New.
- Specify a title – in my case I've used GA4 Web Configuration (staging) and GA4 Web Configuration (live) as I'll use this single tag across all of my websites.
- For Tag Configuration, select the Google Analytics: GA4 Configuration type.
- Paste the Measurement ID for your data stream that you noted down earlier into the relevant field. Leave the other settings as default.
- For Triggering, select the trigger for the first of your websites, and then use the + icon to add the other websites (if any) you want to configure GA4 for.
For more details, take a look at this article: Google Analytics 4 tags.
Preview and publish your container
Finally, it's time to preview your container:
- Hit Preview, enter the URL you want to test (e.g. https://www.mytheatre.com) and hit Connect. A window will pop open with your website and a loading bar will display in the GTM window. Once it's loaded, hit Continue in GTM.
- You should be able to see your GA4 Configuration tags listed under Tags Fired on the Tags tab. If it's not there it means your tag isn't being triggered on the URL you entered. To troubleshoot, click on the tag and check the Firing Triggers are correct. In my case I have a firing trigger of Page Hostname equals mytheatre.com and a default GTM tag of _event equals gtm.js.
- When you're happy your tags are set up correctly, hit the cross in the GTM preview window, hit Stop debugging and close the GTM preview tab.
And last but not least, publish your container:
- Hit Submit in the top-right corner.
- Make sure Publish and Create Version is selected. Enter a Version Name (in my case I'm going with GA4 staging setup) and a Version Description (e.g. Created triggers and GA4 Configuration tag for staging websites).
And you're done! Note that data won't start pulling through to your reports for up to 48 hours (it's usually much quicker!) and you'll see a No data received in past 48 hours message on your data stream. However you can check that the data is being successfully sent to GA4 by looking at the Realtime report in the Reports section of GA4. If you're still not seeing anything, check that your GA Configuration tag is firing by heading to your website, right-click and click Inspect and run a find for your Measurement ID in the HTML. If it isn't there, your tag isn't firing and you'll need to review your GTM triggers for the tag.
Step 4 – Link your GA4 properties to Google Search Console (optional)
If you aren't already using Search Console, it's well worth it. By connecting Search Console to your GA4 properties you'll be able to see what your users are searching for on Google, and get more insight into which pages they're first landing on when they click through to your website.
We'll be writing a full run-down of the Search Console setup and how to use it soon, but if you've already got it set up, take a look at this article for the details of how to connect it to your new GA4 properties: [GA4] Search Console integration.
Where can I get help?
Looking for help with your analytics? We'll work with you to identify the best analytics tools to help you track your particular KPIs, and can handle the setup and configuration of Google Analytics, Mixpanel and more. Email [email protected] to find out how we can help.
Also, take a look at these other articles:
- [GA4] Set up Analytics for a website and/or app (Google)
- Switching to Google Analytics 4: what cultural organisations need to know now (One Further)
- Google Analytics 4 tags (Google)