GA4 Cross-Domain Tracking: A Google Analytics 4 Guide
Are you maintaining multiple websites with different domains? What’s more, do the websites form a part of the same user journey? If so, you need to set up Google Analytics 4 – GA4 cross-domain tracking.
We’ll cover some key topics ranging from setting up cross-domain tracking to debugging.
Why do we need cross-domain tracking?
It’s not uncommon for organisations to operate across multiple domains. For instance, some businesses display products on their main site but sell through a third-party platform.
You can track data for multiple domains using GA4 and view that data in your reports. However, it doesn’t allow you to view continuous sessions as users traverse between domains. In other words, as a user goes to a different domain, the session ends.
This is problematic because you’ll:
- Lose the original source of traffic
- See too many users (as new sessions are started again)
Both of which being a problem for budgeting and optimising marketing channels.
Why tracking across multiple domains is hard
GA tracks user interactions using first-party cookies. When a user first comes to your site, they are assigned a cookie with its own identifier.
As you navigate across the site, GA can keep tracking you thanks to the identifier. But as soon as a user changes domains (even if a website is owned by the same company) the cookie stops sending information since Google Analytics can reach only first-party cookies.
How to set up GA4 cross-domain tracking
1. Go to admin in GA
To begin, head to your Google Analytics 4 dashboard. You’ll now need to navigate to your admin page at the bottom left of your screen.
From the admin page, select ‘Data Streams’ from the second column.
3. Select the data stream of your property
From here, choose the data stream of your property.
4. Select configure tag settings
You’ll be presented with a series of options. For now, let’s head to the Google Tag section of the page and choose ‘Configure tag settings’.
5. Configure your domains
Next, select ‘Configure your domains’.
6. Add all the domains you need to track for
It’s time to choose all the domains that you want to track. Keep hitting ‘add condition’ until you’ve added all the domains you need.
And there you have it! You should start receiving data from all your domains.
Are you using GA4 and UA?
If you’ve got a property set up with both GA4 and UA, your cross-domain setup must be identical in both versions. Both UA and GA4 use the same tracking cookie and need uniform settings for cross-domain tracking.
What if my domains are marked as traffic sources?
If this is the case, you’ll need to configure a list of domains for cross-domain measurement as explained in steps 5 and 6.
Remember: Any domains that you enter into this page will also impact enhanced measurement. These domains will no longer be classed as outbound links.
Debugging GA4 cross-domain tracking
To test your cross-domain setup, you’ll need to undergo a debugging process.
There are a couple of ways that you can do this. Let’s look at these different methods.
Look for the GL parameter
Once you’ve finished setting up cross-domain tracking, you’ll need to wait around five minutes.
With that done, you can head to your first website. Find an outbound link to your second domain and click it.
From your second domain, take a look at the URL. If you notice ‘_gl’ then your GL parameter has been added successfully. Good news, data from both domains should start entering your reports!
Using the Google Analytics native DebugView
GA4 has a native DebugView within the interface now which is great for any sort of debugging.
1. Install Google Analytics Debugger Chrome extension
To use the Google Analytics DebugView without any hassle, you can install the Google Analytics Debugger chrome extension. Once installed, head to the “Admin” section on the bottom-left of your google analytics account and click the “DebugView” option from under the Property column.
2. Open up DebugView and make sure everything is working
Right now your report will probably be looking pretty empty. If you head to your primary domain, though, this should change. You’ll see a page_view event pop up.
If you’re not getting any event data through, there might be a problem with your setup. Head to the section below to see how you can fix your DebugView.
3. Make sure the session ID is correct
Click the page_view event and you’ll get some more information. You need to look specifically at event parameters, namely the ga_session_ID, and page_location. As you can see, in this example image, the ID is ‘1688621951’.
When you cross to your second domain, it’s essential that this ID number remains the same.
Important note: Your ID is unique to you and won’t match the example image.
4. Test your second domain
Now it’s time to test your second domain. Head back to your primary site, find an outbound link, and click it. With that done, head back into DebugView and take a look again. Find your new event, and take a look at the event parameters.
Firstly, is your session ID the same? Secondly, does the page_location match your second domain? If you can answer ‘yes’ to both these questions, you’ve successfully enabled GA4 cross-domain tracking.
My DebugView isn’t working
There are several explanations if you aren’t getting data from your device in DebugView. Let’s look at some potential problems alongside some solutions.
You haven’t set the Debug mode parameter
For events to show up in DebugView, they need to have the Debug mode parameter attached. This is ‘ep.debug_mode’ or ‘dbg’. To ensure this parameter is included, you’ve got several options.
- Making sure you followed the earlier step and installed the Analytics Debugger extension.
- Send a debug_mode parameter with an event.
- Enable the Google Tag Manager preview mode on a page you’re debugging.
Your browser is blocking GA4 tracking
You might not realize it, but you could have installed a browser extension that’s interfering with GA4 tracking. If, for example, you’re using the Google Analytics opt-out extension, all data from your browser will be blocked.
Of course, there are less obvious examples. An ad blocker extension, for instance, could also be the culprit. It’s worth taking a look at your extensions, and seeing if you can spot a potential issue. You could also disable extensions one by one to identify the problem.
Keep an eye on filters
Within GA4, you can filter traffic from internal sources. The ‘internal traffic’ filter will block all data from site admins.
To check if this is enabled head into GA4 admin, scroll down to ‘Data Settings’ and ‘Data Filters’. From here, you’ll be able to see if the internal traffic filter is enabled.
GA4 cross-domain tracking FAQs
Do you need GA4 cross-domain tracking for subdomains?
No. GA4 automatically tracks subdomains.
Can I get help with GA4?
As mentioned, GA4 can be a bit of a learning curve. It’s understandable if you need a little extra help. Luckily MeasureMinds is an expert Google Analytics agency that is on hand to help. We can offer assistance with setting up GA4 and making sure cross-domain tracking is properly activated.
Does cross-domain tracking make you lose historical data?
We all know how precious historical data can be. Luckily, as long as you set up cross-domain tracking on an existing GA4 property, you won’t lose data.
Can you do cross-domain tracking on non-owned domains?
If you don’t own a domain, you won’t be able to install any tracking code. The only way you’d be collect data is if you know the owner of the website, and they agree to install the tracking code.
Are there other ways to do cross-domain tracking?
Another method for cross-domain tracking is to use Google Tag Manager. This method involves using GTM and GA in tandem. Using this method, you can get even deeper insights into how users interact on your second domain.
For more information on this method, you can view Google’s guide.