Cross Domain Tracking in GA4 (Google Analytics 4) Setup Guide

Last Updated: February 3, 2023

Google Analytics4 or GA4 is the latest version of Google Analytics.

Google Analytics allows you to integrate mobile app and website usage data into a single GA Property.

This new property is called ‘Google Analytics 4 (or GA4)’ and is available in your GA account when creating a new property.

If you haven’t created your GA4 property yet, you need to create one before setting up cross-domain tracking. Check out this article for more details: How to upgrade to Google Analytics 4 (GA4)

The implementation method is completely new when it comes to updating your existing analytics property (Universal Analytics) to GA4 or setting up a new analytics property in GA4.

In this article, I am going to talk about how to set up cross-domain tracking in Google Analytics 4.

Cross-domain tracking

Cross-domain measurement allows you to uniquely identify your website user across different domains.

With cross-domain tracking, activity is attributed to the same user regardless of domain. This helps to keep user counts more accurate and gives you a complete view of a user’s journey across domains.

When you set up cross-domain tracking, and when an outbound link leads to another domain, the enhanced measurement option to track outbound links is ignored. This allows the same user to be tracked across different domains.

Cookies and cross-domain measurement

Google Analytics uses first-party cookies to identify unique users on the website.

If you have multiple website domains with analytics tracking implemented, GA will create a new cookie every time a user navigates through the website domains.

In this case, the same user will have a separate cookie for each domain and be counted as a separate user for each domain.

With cross-domain tracking implemented, when the user navigates to a different domain, analytics cookies are passed from one domain to another using the URL parameter identified as key ‘_gl’.

For example, https://optimizesmart.com/?_gl=1*abcde5*

This way, you can identify the same user across your domains and get a complete view of the user’s journey.

Setting up cross-domain tracking

In the legacy version of Google Analytics, a complicated setup was required to set up cross-domain tracking.

It was usually done by using the ‘allowlinker’ parameter hardcoded into every single Google Tag Manager tag (if you are using Google Tag Manager) or in every ‘gtag.js’ (Global Site Tag) call.

In the case of Google Analytics 4, setting up cross-domain tracking has been made very simple, and no hardcoded tagging is required like in the earlier version.

It can now be achieved with only configuration settings in the ‘Admin’ section.

Follow the simple steps below to get started:

Note: You will need edit-level access to the GA4 property to set up cross-domain tracking.

Example reference: In the below steps, we are setting up cross-domain tracking between two different GA4 properties.

  1. Sample website domain: example.com
  2. Sample website 2 domain: example2.com

Step 1: Navigate to your GA4 Property. Click on the ‘Admin’ link available on the left-hand side.

Admin 8

Step 2: A new overlay will appear as below. Click on ‘Data Streams’.

data streams

Step 3: Data streams show you all the available streams (GA4 properties and their details).

Select the web property for which you want to set up cross-domain tracking. In our case, we will select ‘Sample Website’ with the domain ‘example.com’.

select property 1

Step 4: An overlay will appear like the one below. Click on the ‘Tagging Settings’ options under additional settings.

tagging settings

Step 5: A new overlay will appear below, with various features available. As of now, we are focusing on cross-domain tracking, so click on the ‘Configure Your Domains’ option.

domain 1

Step 6: You will see the configuration panel opens up like below.

configuration 1

You will see a really important note at the top.

If you are using a legacy version of Google Analytics universal properties and want to set up cross-domain tracking between GA4 and a legacy version, then you need to map the settings between each type of property.

You can click ‘Learn more,’ which will guide you through the required settings.

In our case, we are setting up cross-domain tracking for GA4 properties, and it will be simpler.

Here we just need to add our domains, and, as I said earlier, no hardcoded changes are required.

Just click on ‘Add condition’.

Step 7: You will get the option to select the math type for the domain conditions. You can use any of the following to meet your business needs.

  • Contains: Includes part of a string in the domain name.
  • Begins With: Includes domains that start with a specified string.
  • Ends With: Includes domains that end with a specified string.
  • Exactly Matches: Exactly matches the whole part of a domain string.
  • Matches Regex: Powerful lookups to match multiple domains from the list specified.

In our case, we will use a simple match type – ‘contains’.

Step 8: Add the domain like the one below. We are adding the domain name for the sample website 2.

(Match Type: Contains and Domain: example2.com)

website 1

Now click on ‘Save’.

Step 9: Now navigate to the data streams tab in the ‘Admin’ section and select another web property. In our case, we will select the domain for sample website 2 – example2.com.

select property 2

Step 10: An overlay will appear like the one below. Click on the ‘Tagging Settings’ option under additional settings.

tagging settings

Step 11: Click on the ‘Configure your domains’ option.

domain 2

Step 12: You will see the configuration panel open up like below. Just click on ‘Add condition’.

configuration 3

Step 13: You will get the option to select the math type for the domain conditions.

In our case, we will use a simple match type – ‘contains’.

Now add the respective domain of the first website in the textbox next to the match type.

Match Type = Contains and Domain = example.com.

ga4 cross domain tracking

Step 14: Click on ‘Save’.

Congratulations!!! You have successfully configured the cross-domain tracking.

Now the cross-domain setting is done, when the users navigate from one website to another, it will be counted as a single visit, and all the traffic sources will be consistent throughout.

Debugging the setup

You can debug the cross-domain tracking functionality in order to validate the setup.

Navigate to any of your websites and click on the link to another domain for which you have configured the cross-domain tracking.

Once you click the link, you will be redirected to the new domain, and you can check the URL will be populated with a new ‘_gl’  parameter like the one below.

debug

If you see the ‘_gl’ parameter in the URL, your cross-domain tracking is working properly.

This ‘_gl’ parameter will continue the session from the previous domain to the new domain, and it won’t be treated as a new user.

It will also pass all the GA information it has on the earlier domain, such as traffic source, attribution modelling, and GA cookie values.

What will happen if you set up individual data streams for each subdomain in a single GA4 property?

Will it result in inflated website traffic?

GA4 automatically tracks traffic from all subdomains within a single property by default. 

But you can also set up individual data streams for each subdomain.

When you set up individual data streams, GA4 tracks the data for each subdomain separately.

This can be useful if you want to see data specifically for each subdomain rather than combined data for all subdomains.

It will not result in inflated website traffic as GA4 uses a unique measurement ID for each data stream, so it will not double-count the traffic.

Each data stream will have its own metrics and reports, allowing you to analyze the data separately.

However, there are some major downsides to setting up individual data streams for each subdomain in GA4:

1) Setting up individual data streams for each subdomain requires more tracking setup, maintenance and troubleshooting. Hence increased complexity and higher data management costs.

2) With individual data streams for each subdomain, it can be harder to see the overall picture of the website’s performance across all subdomains as the data is split across multiple data streams. This can make it more difficult to identify trends and patterns in the data.

3) When you set up individual data streams for each subdomain, tracking cross-domain behaviour, such as a user’s journey across different subdomains, can become harder.

4) Individual data streams for each subdomain can lead to a lack of data continuity, making it harder to compare data over time.

5) Individual data streams for each subdomain can make creating and managing audiences, custom dimensions and metrics, and other reporting features more difficult.

6) If different teams are responsible for different subdomains, each team may have their own methods and processes for setting up and configuring data streams, tracking events, and analyzing data which can make it difficult to compare data from different data streams.

The inconsistencies in how data is collected and analyzed across subdomains can also make it difficult to identify trends and patterns in user behaviour across subdomains.

  1. Cross Domain Tracking in Google Analytics – Complete Guide
  2. How to check cross-domain tracking in Google Analytics
  3. Google Analytics Subdomain Tracking Tutorial
  4. Cross Domain Tracking with Google Tag Manager (GTM)
  5. Setting up Sales Funnel across websites in Google Analytics
  6. Google Analytics cookies: _ga cookie, _utmb, _gat – Tutorial

#1 Google Analytics 4 Intro

  1. What is GA4 (Google Analytics 4) – The Apps + Web Property?
  2. Key Benefits of Using Google Analytics 4 (GA4)
  3. Setup GA4 – Upgrade to GA4 – Implementation Guide
  4. Google Analytics 4 (GA4) vs Universal Analytics – What is the Difference?
  5. GA4 vs GA4 360 – Pricing, Limits, Billing and More
  6. Google Analytics 4 Training & Tutorial with FREE GA4 ebook

#2 Google Analytics 4 Property

  1. Google Analytics Account Hierarchy (Structure Explained)
  2. Understanding Google Analytics Measurement ID (GA4)
  3. Google Signals GA4 – See Demographics (Gender, Age) in Google Analytics 4
  4. Using the GA4 (Google Analytics 4) Test Property
  5. Google Analytics 4 Sub Properties Tutorial
  6. Roll up Property in Google Analytics 4 (GA4) – Tutorial

#3 Google Analytics 4 Integrations

  1. How to connect GA4 (Google Analytics 4) with Google Data Studio
  2. How to link GA4 (Google Analytics 4) with Google Ads
  3. How to link Google Search Console to Google Analytics 4 (GA4)
  4. How to Install Google Analytics 4 on Shopify
  5. GA4 Firebase Integration – Correctly Add App Data Streams to GA4 Property

#4 Google Analytics 4 Events

  1. GA4 (Google Analytics 4) Event Tracking Setup Tutorial
  2. Understanding Event Parameters in Google Analytics 4 (GA4)
  3. Recommended Events in Google Analytics 4 (GA4)
  4. Enhanced Measurement Events in Google Analytics 4 (GA4)
  5. Automatically Collected Events in Google Analytics 4 (GA4)
  6. How to Set Up GA4 Custom Events via Google Tag Manager
  7. Events Report in Google Analytics 4 (GA4)
  8. How to Rename Events in Google Analytics 4 (GA4)
  9. How to Use Google Analytics 4 Event Builder
  10. GA4 Form Interactions Tracking – Enhanced Measurement

#5 Google Analytics 4 Conversions

  1. Google Analytics 4 Conversion Tracking Guide – GA4 Goals
  2. How to Import Conversions from GA4 Property to Your Google Ads account
  3. GA4 Conversion Rate – How to find it and use it

#6 Google Analytics 4 Dimensions

  1. GA4 (Google Analytics 4) Dimensions Tutorial
  2. GA4 (Google Analytics 4) Custom Dimensions Tutorial
  3. GA4 User Properties (User Scoped Custom Dimensions) – Tutorial
  4. Event Scoped Custom Dimensions in GA4 – Tutorial

#7 Google Analytics 4 Metrics

  1. GA4 (Google Analytics 4) Metrics Tutorial with Free Google Analytics 4 Ebook
  2. GA4 (Google Analytics 4) Custom Metrics Tutorial
  3. What are Predictive Metrics in Google Analytics 4 (GA4)

#8 Google Analytics 4 Ecommerce

  1. GA4 (Google Analytics 4) Ecommerce Tracking via GTM – Tutorial

#9 Google Analytics 4 Specialized Tracking

  1. GA4 (Google Analytics 4) Enhanced Measurement Tracking Tutorial
  2. Cross Domain Tracking in GA4 (Google Analytics 4) Setup Guide
  3. GA4 Site Search – Tracking Site Search in Google Analytics 4
  4. GA4 (Google Analytics 4) Scroll Tracking Tutorial
  5. Self-referral Google Analytics 4 – Referral exclusion GA4
  6. GA4 (Google Analytics 4) Data Import Tutorial
  7. Google Analytics 4 Content Grouping – Create Content Groups in GA4
  8. How to Track Single Page Apps in Google Analytics 4 (GA4)
  9. utm_source, utm_medium, utm_campaign Parameters – GA4 (Google Analytics 4)
  10. GA4 Form Tracking via Google Tag Manager

#10 Google Analytics 4 filters

  1. GA4 filters – Understanding Data Filters in Google Analytics 4
  2. How to Create and Test Filters in Google Analytics 4 (GA4)?
  3. Exclude Internal Traffic in GA4 (Google Analytics 4) via IP Filter

#11 Google Analytics 4 Explorations

  1. Free Form Report in GA4 (Google Analytics 4) – Exploration Report
  2. How to Use the User Lifetime Report in Google Analytics 4 (GA4)
  3. How to Use Path Exploration Report in GA4 (Google Analytics 4) – Path Analysis
  4. How to Use Segment Overlap Report in Google Analytics 4 (GA4)
  5. How to Use the Funnel Exploration Report in GA4 (Google Analytics 4) – Funnel Analysis
  6. Cohort Exploration Report in Google Analytics 4 (GA4)
  7. How to Create Landing Pages Report in GA4 (Google Analytics 4)
  8. How to Create Google Ads report in GA4 (Google Analytics 4)
  9. How to Segment GA4 Data by Data Stream
  10. Organic Search Traffic Analysis in GA4 – Complete Guide
  11. Google Analytics 4 (GA4) Outbound Links Tracking
  12. How to Track Email Campaigns and Traffic in GA4 
  13. How to view full page URLs in GA4?

#12 Google Analytics 4 Advanced

  1. Understanding Google Analytics 4 Sessions
  2. GA4 (Google Analytics 4) Measurement Protocol Tutorial
  3. How to Build Comparisons (Advanced Segments) in Google Analytics 4 (GA4)
  4. Understanding Automated Insights in Google Analytics 4 (GA4)
  5. Understanding Channel Groupings in Google Analytics 4 (GA4)
  6. Understanding Data Sampling in Google Analytics 4 (GA4)
  7. Google Analytics 4 Regex (Regular Expressions) Tutorial
  8. Google analytics 4 GDPR compliance checklist

#13 Google Analytics 4 Reports

  1. How to Create Custom Insights in Google Analytics 4 (GA4)
  2. How to Use Debug View Report in Google Analytics 4 (GA4)

#14 Google Analytics 4 Attribution

  1. Guide to Attribution Models in GA4 (Google Analytics 4)
  2. How to Change Attribution Models in GA4 (Google Analytics 4)?
  3. GA4 (Google Analytics 4) Conversion Paths Report in Attribution
  4. GA4 (Google Analytics 4) Model Comparison Report in Attribution
  5. Advertising Snapshot in GA4 (Google Analytics 4) Attribution
  6. GA4 Attribution Modelling Tutorial

#15 Google Analytics 4 Audiences

  1. GA4 Audiences – Creating Custom Audience in Google Analytics 4
  2. How to Create a Remarketing Audience in Google Analytics 4 (GA4)
  3. Understanding Audience Triggers in Google Analytics 4 (GA4)
  4. Google Analytics 4 (GA4) Predictive Audiences – Tutorial

#16 Google Analytics 4 BigQuery

  1. GA4 BigQuery – Connect Google Analytics 4 with BigQuery
  2. BigQuery GA4 Schema – Send Custom GA4 Data to BigQuery
  3. How to Backfill GA4 Data in BigQuery
  4. How to Connect and Export Data from GA4 to BigQuery

Frequently Asked Questions About GA4 Cross-Domain Tracking

What is cross-domain tracking?

Cross-domain measurement allows you to uniquely identify your website user across different domains. With cross-domain tracking, activity is attributed to the same user regardless of domain. This helps to keep user counts more accurate and give you a complete view of a user’s journey across domains.

How does cross-domain tracking work?

Google Analytics uses first-party cookies to identify unique users on the website. With cross-domain tracking implemented, when the user navigates to a different domain, analytics cookies are passed from one domain to another using the URL parameter identified as key ‘_gl’. For example, https://optimizesmart.com/?_gl=1*abcde5*
This way you can identify the same user across your domains and get a complete view of the user’s journey.

Is it easier to set up cross-domain tracking in GA4?

In the legacy version of Google Analytics, a complicated setup was required to set up the cross-domain tracking. In the case of Google Analytics 4 setting up cross-domain tracking has been made very simple and no hardcoded tagging is required like in the earlier version. It can now be achieved with only configuration settings in the ‘Admin’ section.

How do I know if cross-domain tracking is working correctly?

You can debug the cross-domain tracking functionality in order to validate the setup.
Navigate to any of your websites and click on the link to another domain for which you have configured the cross-domain tracking. Once you click the link you will be redirected to the new domain and you can check the URL will be populated with the new ‘_gl’  parameter like below. If you see the ‘_gl’ parameter in the URL that means your cross-domain tracking is working properly. 

Register for the FREE TRAINING...

"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

​#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.

#4 ​Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

​#7 How to learn and master digital analytics and conversion optimization in record time.



   

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade

Learn and Master Google Analytics 4 (GA4) - 126 pages ebook

X
error: Alert: Content is protected !!