How Google Analytics 4 Uses Cookies to Track Visitors

Laura Caveney
4th October 2022

Cookies have been the main way marketers have tracked users visiting their websites. But how does Google Analytics use cookies, and how will this change? 

Every time you visit a website, you’re adding a cookie to your browser. That’s huge amounts of tracking information on you and the content you engage with. 

These cookies are an essential tool for marketers to better understand how people engage with their website. 

Google Analytics uses cookies to show more detail on who website visitors are and how they behave. 

Pretty useful. 

But as privacy laws change and tools move to better protect their users’ data, businesses like Google are left looking at the prospect of a cookieless future. 

So, let’s dive in. This blog will run you through: 

Does GA4 use cookies? 

Yes, Google Analytics 4 uses first-party cookies which keeps them compliant with privacy laws like GDPR.

Related: The difference between first and third-party cookies

However, GA4 has also started incorporating machine learning to fill possible data gaps. 

Given the issues posed by tracking via cookies, most recently the iOS 14.5 update, Google is scrambling to find better ways to track users.

Related: iOS 14.5 Update: How to best prepare as a paid marketer

To deal with this, GA4 is centred on the idea of tracking user IDs instead of cookies. 

Combining these, in what they call “blended data”, they explained in their blog that: 

“Because the technology landscape continues to evolve, the new Analytics is designed to adapt to a future with or without cookies or identifiers. It uses a flexible approach to measurement, and in the future, will include modelling to fill in the gaps where the data may be incomplete. 

“This means that you can rely on Google Analytics to help you measure your marketing results and meet customer needs now as you navigate the recovery and as you face uncertainty in the future.”

💡Pro Tip 

As we move to a cookieless future, marketers need to prepare. We share exactly how to collect first-party data in a cookieless world

Current data collection in Google Analytics 

Let’s imagine a scenario. 

A user is on their daily commute, goes on their phone and lands on your website. 

Later, that same person goes to work. They open their laptop and head back to your site. 

That evening, the same person, now back at home, looks at your site again this time on their home desktop. 

Despite this being a single-user journey, Universal Analytics had no way of connecting these three separate browser sessions due to cookie limitations so they appear as three different sessions. 

Google could look at Client ID but this is attached to a device. So, you would be left with the same problem. 

google analytics user tracking - user explorer - www.ruleranalytics.com

Now, for websites looking to track logged-in users, there is a solution. This is where we introduce you to user ID. 

But first, it’s worth talking about what you would do if you want to track users who aren’t logging in. 

Well, the simple truth is, it’s hard to collect accurate customer journey information. 

🚀 Pro Tip 

We recommend learning more about attribution and the role it can play in helping you track your visitors. 

Read more on marketing attribution and how it all works, or see exactly what you can discover in Ruler to understand what customer touchpoint data you can access. 

What is user ID in Google Analytics 4? 

In Google Analytics 4, you can access the user ID feature. 

Related: How to track individual users in Google Analytics

This allows you to associate identifiers with individual users so that you can connect their behaviour across different sessions and devices. 

As opposed to Google Analytics counting new users via cookies, it would instead use the user ID leading to more accurate user counts and more data on how users engage with your content.

How to get started 

First things first, you need to create a unique ID for each user and assign them to your users. This can be during login.

So when a user logins in via inserting an email address, that will create a unique ID that you can then use to track them onsite. 

Note It’s up to you to ensure that your use of user ID falls in line with the Google Analytics Terms of Service

Next, you need to ensure your property uses a reporting identity that includes the user ID option. 

First, head to Admin and make sure you select your desired property. 

In the Property column, click Reporting Identity

Select either By User-ID, Google signals, then device or By User-ID and device. 

To send your user IDs, read the full guide from Google

What you can do with user ID in GA4

There are many things you can do using your user ID in Google Analytics. 

They are: 

Compare signed-in with non-signed-in users

You can easily compare users who are signed in to those not by building a comparison that uses the Signed in with user ID dimension which should be set to ‘yes’. 

A comparison including the "Signed in with user ID" dimension and dimension value = yes

Look at user exploration

User exploration is a report that’s available within the Explore tab in GA4. 

You can configure a new exploration (or report) and drill down into the list to see detailed information about individual users, including: 

⚡️Pro Tip 

Want to learn more about customer journey mapping? You should be able to track users end to end to better understand their touchpoints.

Read our complete guide to customer journey stages and how to track them

Create remarketing audiences 

Everyone is looking to create remarketing audiences following the iOS 14.5 update. And the user ID in GA4 can help as you can create audiences based on this field. 

If you’ve already linked your GA account to your Ads account, then these audiences will be available to add to campaigns in your shared library. 

Getting comfortable with Google Analytics cookies? 

Remember, cookies won’t be around forever. 

And while Google is making moves to turn cookieless, user ID is only useful for those sites where users can log in. And that probably only covers a small percentage of your website sessions too. 

Plus, it has further limitations. 

If a user completes an action before they’ve signed in, then when they sign in, all of their events will still be attributed to that user ID.

However, if they then sign out and trigger another event, that event will not be attributed. 

So, it could still result in some discrepancies. 

The best way to counter this and track every single lead from start to end is to use a marketing attribution tool. You’ll be able to see exactly what touchpoints each customer took. 

Sound good? Book a demo to see it in action, or sign up for our newsletter to keep learning.