Hey there, I'm Benjamin from Loves Data. In this video,
you will learn how to set up cross-domain tracking in your GA4 (Google Analytics
4) property. Setting up cross-domain tracking has been simplified in GA4,
but there are some considerations, especially if you're also tracking your website with
Universal Analytics. So let's jump in and configure cross-domain tracking in GA4...
Okay, so we're in the admin area of Google Analytics. And the first thing we should
check are the data steams for our GA4 property... We can see there is a data stream for my demo
site. So let's start by looking at what is reported if we travel between the top-level
domain and a sub-domain. Let's head to my demo site... And I'm going to enable the
Google Analytics Debugger so we can easily see what's happening in Google Analytics...
Okay, now that the debugger is connected, let's head back
to Google Analytics... And let's open the DebugView...
We can see that hits have been set to our GA4 property. Let's select the pageview hit...
And let's look at the session ID... We can make a note of this session ID,
and now let's head back to my demo site... Now I'm going to click the link to the sub-domain...
And now that the page and debugger have loaded, let's head back to Google Analytics...
We can see the hits come through, and let's select the pageview hit...
And let's check the session ID... We can see the session ID is the same,
it hasn't changed even though we're now on the sub-domain. This means that we don't
need to configure anything to track people as they visit sub-domains on our website. Okay,
but what about cross-domain tracking? Let's head back to my demo site to see what happens without
any configuration... Now I'm going to click the link to travel to an entirely different domain...
And let's head back to Google Analytics...
We can see there is another pageview. Let's select this... And let's look at the session ID... The
session ID is different. This means that Google Analytics is reporting two different sessions.
One for the first domain, and a separate session for the second domain.
So currently, each domain is being reported separately. This isn't what we want. Correct
cross-domain tracking is where the user and session are recognized as being the same as
they travel between the domains. So we need to configure cross-domain tracking for our site.
To do this, let's navigate to 'Admin'...
Let's select 'Data Streams'... And let's select the data stream for my demo site...
Now let's scroll to the bottom... And let's select 'Tagging Settings'...
We can now choose the option to configure our domains for cross-domain tracking...
Let's select 'Add Condition'... And I'm going to enter my first domain...
And now I'm going to enter my second domain...
If you also have Universal Analytics implemented on your website,
then you need to make sure that you configure cross-domain tracking for the same domains.
If this applies to you, then check out the extra resources below this video. I've included a link
to my cross-domain tracking tutorial for Universal Analytics. Now I'm going to click 'Save'...
Let's close the settings... And head back to the debugview...
Now let's head back to my demo site... And I'm going to navigate back to the first domain...
And then I'm going to click the link to travel back through to the second domain...
Now let's head back to Google Analytics one more time...
We can see a pageview hit has come through. Let's select it...
And let's check the session ID...
We can see it's now the same as the session ID we saw when we first loaded the demo site.
And let's check the page location... We can see this is for the second domain...
This means we've now configured cross-domain tracking for our GA4 property.
Users and sessions will now be maintained as people travel between the two domains. That's it!
So that's how you can set up cross-domain tracking in your GA4 property.
Remember, if you're also tracking your website with Universal Analytics,
then you will need to ensure the domains you've configured for cross-domain
tracking should be the same as the domains you've configured in your GA4 property.
Are you going to configure cross-domain tracking for your GA4 property? I'd love to know! Let me
know in the comments below. And if you found this video helpful please subscribe, share it with your
friends, and hit the like button so I know to make more videos like this. See you next time!