How To Set Up Cross Device Tracking in Google Analytics

If you are a website owner, you’re probably aware that your visitors come to your website in many ways, shapes, and forms. It’s also possible that repeat visitors will come to your site from many different devices. You know, computers, phones, tablets (and possibly even cars, watches, TVs).

The same physical human being can visit your site in many ways across many browsers. But according to your analytics data, they will be treated as separate users taking separate actions after consuming your content.

That’s because by default, every modern analytics tool tracks devices, not people.

So, what happens to your analytics data when I visit your website from two different devices?

Your Google Analytics account will think I am “Regular Jeff” and someone else, who we will call “Mustache Jeff” for distinction and entertainment.

One user device - how to set up cross device trackingOne user device - how to set up cross device tracking

Even though I am only one human being, Google will track all my devices as separate users for reporting purposes.

Tracking devices – instead of actual humans – can cause a big problem with how you trust your analytics data. If one person is counted as two, or possibly even five different users, it can mess up your confidence in analyzing the data you collect.

Good news! There is a potential fix for this problem that we will explore in detail: cross-device tracking.

To understand how cross-device tracking works we need to look at how Google Analytics tracks your website visitors.

How Google Analytics tracks users

Google Analytics doesn’t track people, it tracks unique browser cookies (specifically, the Client ID field) to determine users. Google tracks each unique Client ID they see as a unique user in your analytics reports.

Here is what the Client ID looks like when you visit a webpage. Your Client ID determines your uniqueness.

Google Analytics cookies

So think of your analytics account as a Cookie Monster. Google Analytics loves cookies.

Google Analytics cookies

But, too many cookies for one person can cause problems with your analytics, as well as your physical and mental health.

Each cookie is unique to its browser, and its device. Your cookies contain a Client ID for each website you visit. This ID allows Google Analytics to monitor your behavior on that website.

Client ID Google Analytics cookies

If Google Analytics recognizes your Client ID, it can match up your hits, sessions, and visits across devices. All devices merge into one user. Sweet!

Google identifies users by their Client ID

Let’s return to our original scenario where I visited your site on multiple devices. If you can sync my Client ID across those devices, then you get one “Jeff” in your Analytics report.

syncing user devices - cross device tracking

But if my Client ID remains different on each of my devices, Google Analytics will think I am multiple users.  Google might think I a whole bunch of different “Mustache Men.” ( Sorry couldn’t resist. Look at those staches!).

users devices - how to set up cross device trakcing

If your analytics account is tracking devices, instead of users, it can cause a lot of problems for analysts. More issues than just skewing your visitor metrics.

You conversions become inflated, and it can mangle your attribution modeling.

So how do you fix this problem? How do we track users instead of devices? Cross-device tracking.

There are two ways to set up cross-device tracking in Google Analytics

You can implement cross-device tracking using cookies, or you can use the cloud.

Cross-device tracking with cookies

As we discussed, every browser cookie contains a unique Client ID.

If you want to use this cookie across devices for known users, you can access their Client ID using JavaScript. You can set up a JavaScript a function that reads your visitors’ Client IDs and stores it in your database or stores it in the users local browser.

Once you access the Client ID variable, you can do cool things like:

cross device tracking using cookies

Attach the Client ID to a user record in your CRM

When your javascript function captures the Client ID variable, you attach that variable to a user record in your CRM or proprietary database. You can even match up the Client ID to an email address in your CRM. Then you can store the Client ID as a custom field in your CRM user records.

Store the Client ID on the browser

You can also store the Client ID on the browser’s local storage.

I am not sure of the advantage here, but it seems like there is a use case I’m missing. If you can explain the use case, leave a comment, and I will update this portion of the post.

Set a new Client ID using code

You can access the Client ID using tracking code upgrades, and you can even override the ID using the value from your database. Then you can update the Client ID for each known user.

client ID variable

Use the measurement protocol to send hits to the client ID

Using the measurement protocol is an advanced technique for tracking in Google Analytics. The measurement protocol is an open way to send data into Google Analytics. This technique allows you to set the Client ID in your Google Analytics hit, and transmit data about that ID into Google Analytics.

Don’t worry if you’re a little confused right now. Cross-device tracking is pretty “heavy” stuff.

cross device tracking is heavy stuff

Let’s make it as simple as possible

  • You start by identifying your users as they hit your website. You could identify logged-in users of your site or app. Or it could be because they clicked through to your site from their email. Either way, you will begin the identification process outside of Google Analytics.
  • After you’ve identified your user, you tell Google Analytics to match up their Client IDs by setting the Client ID consistently on all devices. When Google processes the reporting data, the Client ID will match across devices and sessions, and they are treated as one unique user.

Once you identify your users, you can pass Client IDs across devices!

When you sync the Client ID across devices, all those mustaches disappear. And you have one user, one “Jeff,” instead of five random users, in your Google Analytics reports.

syncing user across device with cross device trackin

 

Is your mind blown right now? Mine was the first time I learned about cross-device tracking. Super amazingly cool stuff, right?

If you thought that was cool, then check this out: there’s a second way you can do cross-device tracking.

Cross-device tracking in the cloud (through User ID)

You can also have Google match up users across devices using their cloud computing power. This method doesn’t involve manipulating cookies. Instead, you identify each unique user by appending a unique User ID to the hits that are coming into your Google Analytics data.

Google will match up users, based on their User IDs, in the cloud.

Let’s break down how this works.

A User ID is a unique alphanumeric variable that you assign to each known user. There’s a line in your analytics code that allows you to set the User ID.

Using this tracking code enhancement, you can set any User ID that you define. Of course, you have to identify your users first. But once you’ve identified them, you can tell Google that they belong to that specific User ID.

User ID in cross device tracking

User ID accepts no PII, please

Google will not allow you to assign a User ID that can be personally identifiable. Some examples of unacceptable User IDs include name, SSN, email address, etc. The User ID has to be unique and cannot violate the user’s anonymity.

User ID policy

Here are some ways you can create new User IDs:

new User IDs in cross device tracking

Account database User ID.

If your site login system has a database record for each person, you can use that record as the User ID.

Email marketing tool ID

Usually, your email marketing tool assigns each user a unique number. This number has no personally identifiable characteristics. So you can use it as the User ID.

Your CRM User ID

You can assign you CRM ID as the new User ID. Using the CRM ID is similar to using your email marketing tool ID.

Randomly assigned ID

If you maintain other user records, you can randomly assign an ID to each record. As long as this ID is not recognized outside your system, it can become the new ID in Google Analytics.

Cross-device tracking is pretty advanced. That’s why we cover it in depth in our Advanced Google Analytics lessons.

But, the bottom line is, if you can tell Google Analytics who a user is, they will match that user up across all devices.

You can implement cross-device tracking using Client ID (cookies) or the cloud (User ID).

Why doesn’t Google automatically set up cross-device tracking?

Google has Chrome and user account records (Gmail). They likely have more data about user behavior at their disposal than anyone else in the world.

It would be more straightforward and more accurate if Google set up cross-device tracking across known users. But Google is not going to do cross-device tracking for you. And there are many good reasons why Google won’t share their user data.

Fred from our Analytics Course asks a great question about how Google uses their data.

Analytics Course student question

Fred asks:

But if I’m logged in to Google on each device, is it safe to assume that the demographic info Google collects about me is actually fed from all three devices? I’m thinking there’s a master “fred” demographic row in some giant database somewhere, that is fed by all the devices “fred” is logged into.

I understand the difficulty of tracking across devices. Even if I use Chrome on my desktop, tablet, and phone, that’s still three different sets of cookies that are placed on the different devices, and they’re not merged.

Essentially Fred wants to know if Google maintains a master profile on each one of us.

I don’t know the definitive answer to Fred’s question. But I do think that Google keeps a record of our user behavior in their third-party cookies.

I think Google matches people across Chrome and shares cookies on Google websites. Tracking is likely the main reason Google creates products like the Chrome web browser and Android operating system. These tools give Google full control of tracking their users across the internet.

I think Google uses this data for their advertising products

This data makes Google’s advertising platforms better.

But I don’t think Google is going to provide this same data automatically in Google Analytics. The best we will do is better targeting in AdWords and Doubleclick.

How does that work? One example is how Google estimates how many AdWords conversions you have, even without a tracking code. AdWords is Google’s biggest moneymaker, so they do whatever they can to keep you hooked on their ad platform.

Google has much less incentive to release their treasure trove of data into Google Analytics.

Sharing cross-device user data in analytics wouldn’t necessarily increase Google’s earnings. Also, it would be a privacy violation and GDPR nightmare for the EU. Changes in privacy regulations are making it harder to track users, not easier. We’re trending towards giving users the power to decide whether or not they accept tracking.

What do you think Google does with their top-secret data stash?

Those are my current thoughts on how Google tracks us and if they will ever share all their data. I would love to know what you think. Does Google maintain a master profile on us? And would they ever give us access to this information? Share your opinions in the comments below.


This post and video was episode 53 in our 90 Day Challenge digital marketing series.

To get access to all 90 videos, subscribe to our YouTube channel. YouTube will send our subscribers weekly emails about all the videos we published over the past week.

Want to know about each video and post as soon as it comes out? Sign up for the 90-day challenge email newsletter. The newsletter will be the best way to make sure you don’t miss any of the content.