Setup Cross-domain tracking in Google Analytics 4
In new Google Analytics 4 (GA4) properties cross-domain tracking has been re-built as well, and now makes this process a lot simpler for non-technical users.🎉 Before the release of the new property, it was done in Google Tag Manager or directly in the source code by editing related tag settings.
In this article, I will cover the basic cross-domain tracking setup for the GA4 property.
5 step GA4 Cross-Domain setup
1. Open your Data Stream
As the setup is done in UI of the new GA4 property, you should open your Google Analytics and go to Admin > Data streams > Select your website stream.
If each of your websites are added as a separate data stream, then you will need to repeat the setup in all of them.
2. Then navigate to the “Tagging settings.”
3. Select “Configure your domains”
4. Select “Add condition” in order to add domains that you want to track.
Important thing to note: If you’re using both Universal Analytics and Google Analytics 4 at the same time, your cross-domain setup must match between both properties. You can read more here
So if you’re setting up GA4 in parallel to your existing Universal Analytics tracking, you need to have some domains and settings in both of them. As new GA4 and old Universal Analytics use the same cookies for identifying a user, it might produce unexpected results in your reports.
5. Add domains you want to track.
You may create a separate condition for each domain or just use regular expressions to combine them all together.
In the example below I’m adding ezsegment.com and activedatalab.com
And that’s it! 🙌 Once settings are saved, your cross-domain tracking will be LIVE on your websites. Now if you click on any link that leads to another domain, you will see it appends a new _gl parameter.
After the click, in browser, you will see a similar URL as I have here: https://ezsegment.com.com/?_gl=11e8agmr_gaMTQyNTk5NDU2NS4xNjAxMTI5NjY3_ga_DXP2EPWNJX*MTYwNDE0NzMwNS44LjAuMTYwNDE0NzMwNS4w
GA4 Cross-domain tracking caveats
1. Keep an eye on JavaScript redirects
While this feature is really helpful for the marketers and will cover the needs of a wide range of websites, you should look out for JavaScript redirects. For example, if you have an e-commerce website where you have a checkout on a 3rd party domain and the user is redirected there using JavaScript – this solution will not work.
In such cases tracking ID (gl parameter) must be applied manually with the help of a developer.
2. Keep cross-domain settings the same as in existing Universal Analytics
As mentioned above in Step #4 – You should double-check your existing Universal Analytics settings so that they match in your new setup, otherwise you could experience some discrepancies.
To sum up, it’s really nice to see that Google is making things easier for non-technical users, allowing for faster and more straight-forward setup. Definitely there will be some edge cases where you need to either adjust GTM settings or ask for developer help, but this is very nice start for Google Analytics 4 🙂
I hope this guide was helpful and your cross-domain tracking is up and running!