Google Analytics 4 multi-site tracking
under one account is a very common request from our clients.
You can track:
- Subdomains automatically —all visitors to both dogs.example.com and www.example.com, with data for both showing in the same report view (profile)
- Subdirectories—only visitors to the www.example.com/dogs subdirectory in a separate report as if it were a single site
- 3rd-party shopping carts—visitors to your online store and to your shopping cart hosted on another domain
- Top-level domains—all visitors to two domains that you own, such as www.example-petstore.com and www.my-example-blog.com, with data for both showing in the same report view (profile)
You can find instructions on its website but they are quite general. A few years ago it was a most painful part of GA coding and most difficult to set up correctly.
- The problem of multiple domains
- How does cross-domain tracking work in Google Analytics 4? Steps 1-5.
- Will Google Analytics track subdomains?
- How to configure cross-domain tracking in Google Analytics 4?
- Test the setup
- Final words
Currently, after last years’ changes, it is quite easy to setup multi-site tracking in GA4.
The problem of multiple domain tracking
It is a workaround that allows webmasters/marketers/analysts to send user’s/visitor’s identifiers from domain A to domain B and preserve the session information. That way, the visitor is being tracked as the same person across multiple websites and domains by Google Analytics 4 tag.
In order for this to work, both websites must use the same GA4 data stream (a.k.a. same measurement ID).
Subdomain’s tracking
If you want to track different websites that belong to the same domain (e.g. blog.yourwebsite.com and www.yourwebsite.com), Google Analytics 4 will handle that automatically.
Step #1. Go to the Admin of Google Analytics > Data Streams and select web data stream
Step #2. Go to Configure Data stream.
This is the place where you can add all needed domains for the multi-site tracking.
Step #3. Go to Configure tag settings
You will see many options to configure, but we will concentrate only on domains.
Step #4. Go to Configure your domains
Step #5. Add your domains
You can add there domains which can be tracked under the same container ID. Google Analytics 4 will even suggest some domain which you own.
It is the place where you setup your multi-site tracking.
This will also affect your automatic outbound click tracking in Enhanced Measurement. Domains that you enter here will not be treated as outbound clicks anymore.
Test the setup of your Google analytics 4 multi-site tracking
Once you have saved your changes, wait for a minute or so and then go to your first website (let’s say it’s domainA.com). On that website, you will have to find a link that will redirect the visitor to domainB.com.
Click it. Once you are redirected to the 2nd domain, check the URL. It should contain the _gl= parameter with a lot of stuff.
I present below Cloudflare.com when you click “login”, you are redirected to another site with the gl parameter. This will work exactly the same on your linked domains in Google Analytics 4.
Final words
Google Analytics 4 is a next generation of web analytics. It changes the approach and prepares businesses to unified methodology across all Google Tools, like Google Ads, Google Tag Manager and all advertising apps.
If you have any problems with setting it, we can help. Please feel free to contact us.
Share this entry