Google Analytics 4 Setup Guide

Summary of content
  • Google Analytics 4 rolled out in October 2020
  • It can run alongside your Universal Analytics
  • And Universal Analytics will stop processing hits in July 2023
  • Now is the time to install GA4 and start collecting data!
  • Learn how to create a new GA4 property
  • Configure for basic data collection
  • Spot and avoid common pitfalls
  • Install via hard-coding or Google Tag Manager

Overview

If your job depends at all on the use of Google Analytics, you’ve no doubt heard about Google Analytics 4, the massively transformed new version of the platform released in October 2020. If you are a heavy GA user, I’ll go further and wager that either you’ve already installed GA4 and are still grappling with the breadth and depth of the changes, or that fear of those changes has been exactly what’s kept you from installing it.

This resource is meant to allay your fears about GA4, and to guide you through the process of setting it up. 

The most important thing for you to know up front is that you can adopt GA4 right away with no risk. When you set up GA4 in your GA account, you get a new GA4 property alongside your existing UA properties, which carry on collecting data exactly as they have been. Even Google’s official page on the subject reassures the reader that UA tracking is unchanged by the process — and it would need to be, because Google cannot backfill any newly created property with historical data. So let’s dispense with this concern right here at the start: the GA you’ve already got isn’t threatened at all by your trying out the new version. That machine keeps on running while you start learning how to operate the new one in the building next door, so to speak.

Now, having said that, UA isn’t going to last forever either; in fact, Google has announced its intention to sunset Universal Analytics in 2023, meaning that before the end of that year, GA4 will be the one and only version of Google Analytics that will receive ongoing support. Hits in UA will cease to be processed on July 1, 2023 (with an extension to October 1 for Analytics 360 accounts), and all historical data will be deleted from UA properties on January 1, 2024, with no way before or after that date to import that data into a GA4 property. This means that, while you will have the option of exporting and warehousing your historical UA data, the only data collected today that will continue to be accessible in 2024 and beyond inside the Google Analytics interface is the data you collect in GA4, so there is no reason to delay adoption any longer. Time to get on it!

As a last note before we begin the setup process, UpBuild does continue to endorse the practice of running your old UA property side-by-side with your new GA4 property, rather than pulling the plug on UA early. Despite this tight clock, GA4 is still establishing its footing — rolling out new features, squashing bugs, making little nomenclature changes, etc. — meaning that until UA is completely shut down, UA properties will continue to be valuable as 1) stable data stores for continuing with the reporting that we already do and know how to interpret, 2) safety nets for any data that GA4 might fail to collect, and 3) Rosetta Stones to help us comprehend the new language of GA4, which will be so much easier to learn if we have the power to compare reports in GA4 against equivalent reports in UA over the same date range.

Let’s not waste another minute. Time to get going!

Creating a New Google Analytics 4 Property

Because it’s in their interest to get users on board, Google has made this first step very conspicuous. Visit your Google Analytics admin panel, and you’ll see that the new top item under every property in the “Property” column says “GA4 Setup Assistant”. (At one time this said “Upgrade to GA4”, but at some point soon after launch, almost certainly in response to users expressing fears over losing their UA data, Google calmed the language down.) However, we do not want to click this button. Let me briefly explain why before I tell you what to click instead.

If you click “GA4 Setup Assistant”, the new GA4 property that Google Analytics creates for you will be modeled after whichever existing UA property you had pulled up when you clicked. Look at the language that you would see in the next screen if you were to click it:

According to Google’s support page for installing GA4, the elements of whichever UA property you have in front of you that will be copied over to your new GA4 property are as follow:

  • Property name
  • Website URL
  • Timezone
  • Currency settings
  • Tracking code — if and only if you are currently using the gtag.js library
  • Various other configurations from your UA property, which you can read about in greater depth here

UpBuild’s position is that the use of this Setup Assistant creates unnecessary risk. It leaves too many decisions up to Google, and — more concerningly — it presupposes that the UA property you’re choosing to emulate is the best choice from among your (possibly) many. Furthermore, it also presupposes that the selected UA property was itself set up perfectly, whenever and by whomever it was, and is still perfectly aligned with the brand (and measurement strategy) you run today. None of these is a given, and even if you were sure about them, you would save very little time by pursuing this more automated approach.

UpBuild, therefore, suggests that you instead create an entirely new GA4 property from scratch. You do that by clicking the blue “+ Create Property” button up top instead:

After clicking “+ Create Property,” the next screen you’ll see looks like this:

Fill in your property name with something that refers clearly to the website or app that you’ll be using GA4 to track, like “Example.com site” or “Example iOS app”. Remember: if you have more than one of these and you want to track them all, you can create individual properties for each one, but if these websites and apps are all connected — if they all represent one brand and especially if users are encouraged to move between them as part of a single experience — you are advised instead to create a single rollup property that covers the whole span. The individual domains, subdomains, and apps that factor into your property are referred to in GA4 as “data streams”, and will be configured later.

Oh, and don’t worry about those “advanced options”. You know what that is? That is where they have hidden the panel that will allow you to create a new UA property, in case you still want to. Nothing more.

On to Step 2!

These questions are self-explanatory, and the checkboxes at the bottom will have no effect on your access to the platform’s various capabilities. It’s just polling data that they aggregate to determine the most common use cases and the needs and complaints that are likeliest to follow from those. This same self-reporting is also what used to power the old UA Benchmarking feature, which would afford some insight into your site’s performance relative to other sites in the same vertical. This feature has yet to appear in GA4, but I would expect it, or some evolved successor, to show up at some point in the future.

Configuring Your New Google Analytics 4 Property

Once you’ve completed Step 2, your property is created! But it’s not going to be able to collect data until you configure it, which requires completing the last few steps that the wizard will put you through, so let’s address those as well. Here’s the next screen you get:

“Data streams” is the term that GA4 has introduced to distinguish websites from apps, and to distinguish different websites and apps from each other, inside the same property. For the purposes of this guide, we’re going to throw our lot in with the bulk of our clients and readers and select “Web” here. If you’ve created a rollup property that covers more than one stream, you’ll need to pick one to start with and then plan to double back and create new streams as needed.

Next, you’re asked to name your stream and specify what UA used to call your “default URL” and GA4 calls your “Website URL”:

You’re also given the option of enabling “enhanced measurement” by default, which we recommend you do. Enhanced Measurement in GA4 refers to a class of event tracking capabilities that are natively available to all installs of the platform, but not activated by default. They can be individually controlled with simple toggles that appear when you click the gear icon, but the vast majority of business websites would benefit from all the data that they capture. Enhanced Measurement tracks:

  • Scrolls (counted when the bottom of a page is reached)
  • Outbound clicks
  • Site search queries
  • Video engagement
  • Starts
  • Progress markers
  • Completions
  • File downloads

You could always leave this for now and come back to turn it on later, but there’s no real reason not to turn it on at setup. You can simply turn them all on now, or click the gear icon to select only the ones that apply to your site (though nothing is lost if you activate any that don’t apply — for example, if you’ve enabled file download tracking despite having no files to download on your site, all that will happen is that GA won’t find any file downloads to track).

Installing Google Analytics 4 On Your Site

With all this done, and the “create stream” button clicked, we reach the one part of the process that is at all complicated: placing tracking code on your site. Let’s look at the screen that the wizard gives you and take their cues:

If it wasn’t clear before, you have been looking at the actual setup process for the UpBuild site’s own GA4 property, so I have obscured our tags’ two identifying markers, but left the blank spaces bordered so you will understand that they actually contain alphanumeric strings. The Stream ID is not something you’ll be expected to retain, but what they’re calling the Measurement ID is the GA4 equivalent of the Tracking ID in UA, and although it’s formatted a bit differently, it serves the exact same purpose. You’re going to need that.

How you now go about setting up your actual tracking will depend on the method of tracking that your existing UA instance uses, which is worth reviewing. These are the only real possibilities:

  1. Google Tag Manager
  2. Hardcoded tags
    1. The current gtag.js library
    2. The older analytics.js library

If your install is type 2a — gtag.js — you’re going to have the easiest time, because GA4 can run on that exact same library with no new coding required. All you will need to do is navigate to your UA property in a separate tab, visit Admin > Tracking Info > Tracking Code, click Connected site tags under gtag.js, and then enter that new GA4 Measurement ID. Presto done-zo!

If your install is type 2b — the older analytics.js library — you will absolutely need to begin using the gtag.js library in order to use GA4. Just stay in this panel and click Add new on-page tag > Global site tag (gtag.js), and you will be shown your gtag.js code. Just paste that as high in the <head> as you can of every page you’ll be tracking, as you once did with your analytics.js code, and you’re good. The two can exist side-by-side, or you can retrofit your UA instance to run off the gtag.js code you’ve just installed. Your choice!

Naturally though, if you use Google Tag Manager, your installation process will require you to open Google Tag Manager and do a little work there. Just copy your Measurement ID to the clipboard and I’ll take you through these painless few steps in GTM.

Installing Google Analytics 4 via Google Tag Manager

Hop on over to your GTM account, and into the container that currently fires your UA tags on the site where you’re setting up GA4 tracking. Create a new tag, and you’ll quickly notice that there are some new additions up at the top. I’ve highlighted the one we want:

This tag’s name might be a bit perplexing, but it just reflects a way in which they’ve shaken up the tag hierarchy for GA4. “GA4 Configuration” is the name for a new kind of master tag whose sole job is to connect any other GA4 event tracking that you might enable back to the correct Measurement ID. This is the one we need to create now. Click there. The screen you get next looks like this:

That blank pink box is where I pasted the Measurement ID that I’d copied over from GA. The most interesting detail here is that little checkbox that reads “send a page view event when this configuration loads.” Unlike any other specialized event you might track in GTM, though, the standard page view event can be set to fire whenever this configuration tag loads (which per my choice of trigger will be on All Pages, with no exception). So this becomes the means by which your data collection in GA4 can begin. Neat, huh? And all you’ve gotta do is check the box!

[A brief word here about the way GA4 uses the word ‘’event” in comparison to all previous versions of GA, because this has been the source of some confusion since GA4’s launch, and if you don’t know why, you will in a minute. 

In UA, “Event” referred to a custom-tracked instance of user action: something that the standard reporting suite wouldn’t capture, but that you could attach some JavaScript to and track as an extra if you wanted to. Every UA event came with three preordained custom dimensions — Event Category, Event Action, and Event Label — and you would name and classify your events according to these three dimensions. A classic example would be tracking clicks on navigation menu items, using a naming structure like Event Category = “nav”, Event Action = “click”, Event Label = “{{name of item clicked}}”. In GA4, though, an “event” is the fundamental data point, representing any definable instance of user action. The closest analogue in UA to what GA4 calls “events” was “hits”; it’s all events of some type or another now. Everything recorded in GA4 is some kind of event, including page views. And instead of having “dimensions” or “metrics” attached, GA4 events all have “parameters”, which is a single umbrella term meant to cover every aspect of an event that you might be inclined to measure. For more on this, I’ll refer you back to the UpBuild blog post about GA4, which explains all this in more detail.]

Before you publish this GTM container, you’ll want to look back at your UA page view tag to make sure that you’ve taken note of every field to set, advanced setting, or trigger exception present on that tag and recreated it for this tag. There are plenty of sites with complicated load paths that require delicate tag sequencing, and if yours is one of those, and you had to mess around with those special settings to get your page views to record properly in UA, you’ll have to do that same dance here. The good news is that your GA4 tag should have no trouble respecting those same settings that you applied to your UA tag.

Confirming Success

When you’ve got this GA4 Configuration Tag fully set, you’re ready to go! Publish your container and then head back on over to GA4 and take a look at the Real-Time Report to make sure your tracking is working:

Hey look! We’re GA4-ing!

And with that, you have officially Gotten Started! Advanced setup processes (like cross-domain tracking, internal traffic filtration, and more specialized event tracking) will be addressed in future guides like this one, as will the more involved question of how to read these new reports and make use of them. But the best thing you can possibly do right now is complete these first steps and start poking around inside this new platform to see for yourself what it has to teach you.

Happy tracking!