Limited-time sale on all Analytics Mania's courses!

Learn more
  • Courses
    • đŸ”„ SALE đŸ”„
    • Courses
    • Course bundles
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login
  • Courses
    • đŸ”„ SALE đŸ”„
    • Courses
    • Course bundles
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login

September 2, 2025

Cross-domain tracking in Google Analytics 4

Updated: September 2nd, 2025

If you are familiar with cross-domain tracking in UA, you probably know that most of the configuration is done either on the code level (e.g., in gtag.js) or in GTM (GA tags). Because of that, many marketers and web analysts were confused about what to do and where. Luckily, in Google Analytics 4, things have been greatly simplified.

In this guide, I will show how to configure cross-domain tracking in Google Analytics 4. First, we’ll start with the problem that cross-domain tracking solves, and then we will go to the actual configuration.

 

Table of contents

– Here’s what you will learn in this article –

  • The problem of multiple domains
  • What is cross-domain tracking in Google Analytics 4?
  • How does cross-domain tracking work in Google Analytics 4?
  • Will Google Analytics track subdomains?
  • How to configure cross-domain tracking in Google Analytics 4?
  • Test the setup
  • Keep the redirects in mind
  • Cross-domain tracking is not working?
  • Frequently asked questions
  • Final words

 

Video tutorial

Prefer video content to text? Then, you can watch this video tutorial on my YouTube channel.

Since I recorded this video, the GA4 interface changed but the overall concept still remains valid. This article contains newer screenshots, though.

 

Don’t need the introduction? Jump to the configuration

If you are already experienced with cross-domain tracking and you don’t need any introductions, then jump to this section where I’ll show how to configure it in Google Analytics 4.

But if you are new to this, continue reading.

 

The problem of multiple domains

This will be very simplified.

By default, Google Analytics tracks users with first-party cookies. You land on a website, and GA (on behalf of your website) stores a _ga cookie (actually, it stores more, but let’s focus on _ga) in the visitor’s browser (with some random identifier). When you, as a visitor, navigate from page A to page B (of your website), Google Analytics checks the values of that cookie.

Since the cookie is still present (and its value is the same), GA understands that you are the same person who just was on page A, therefore, the 2nd page view is also included in the same session and user.

And that’s great! With web analytics tools (not just GA), you can track how visitors are using your website, what are they doing, etc. Of course, cookies, as a technology, are far from being perfect and have a lot of drawbacks but let’s keep this topic for another blog post.

So where is the problem?

First-party cookies (created on behalf of your website) cannot be shared between two separate domains (due to cross-domain policy). So if you have a website where the journey of a visitor starts on domainA.com and eventually, ends on the domainB.com, Google Analytics on the domainB.com will not able to understand that this is the same visitor as on the domainA.com (even if the GA property on both domains is the same).

When the visitor navigates from domain A to domain B, Google Analytics on domain B cannot reach particular cookies of domain A. Therefore, it creates new ones.

The result? Google Analytics (and other cookie-based web analytics tracking tools) will see you as two separate visitors, one on the domainA.com and one on the domainB.com.

And that’s a big problem. You will see too many users in your GA reports. Every person who visits both domainA.com and domainB.com will turn into two users.

Also, if a new user is tracked, then naturally, a new session will also start, and in your traffic acquisition reports, you will see your domainA.com. This situation is called “self-referral”.

This “self-referral” problem can seriously distort your marketing data. Imagine you spent money on a Google Ad to bring a visitor to domainA.com. When that visitor clicks a link to domainB.com, the self-referral makes it look like domainA.com was the traffic source, not your paid ad. This makes your ad campaigns seem less effective than they truly are and hides the complete customer journey. Fixing this is necessary for accurate attribution and understanding your marketing return on investment.

What should you do? Enter cross-domain tracking.

 

What is cross-domain tracking in Google Analytics 4?

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/domains.

In order for this to work, both websites must use the same GA4 data stream (a.k.a. same measurement ID).

Subscribe and Get the Ebook - Mastering GA4 event tracking

How does cross-domain tracking work in Google Analytics 4?

Here’s the process in a nutshell.

When a visitor navigates from domainA.com to domainB.com, Google Analytics 4 will pass a special parameter to domainB.com’s URL. Thanks to that parameter, the GA on domainB.com will be able to update Google Analytics 4 and will understand that it’s actually just one person navigating between two websites.

 

Will Google Analytics track subdomains?

Yes, and you DON’T need cross-domain tracking for that.

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.

So if you google something like “is subdomain considered as cross-domain?”, the answer in this context is NO.

 

How to configure cross-domain tracking in Google Analytics 4?

Alright, now that we got familiar with the problem (and the solution), it’s time to configure it.

Before you do this, remember one requirement: both websites (that you are going to include in cross-domain tracking) must use the SAME GA4 property installed. The code can be installed directly on the site (gtag) or via GTM. But it’s important that this happens in the same property.

If you have ever tried to set this up in older versions of Google Analytics, you will be happy to see how much easier this process has become. In the past, cross-domain tracking required code changes or complex configurations within Google Tag Manager. In Google Analytics 4, the entire setup is managed with a few simple clicks directly within the GA4 interface.

Step #1. Go to the Admin of Google Analytics > Data Streams and select web data stream.

Step #2. Go to Configure Tag Settings.

Step #3. Click Configure your domains

Step #4. Enter all domains that should be included in the cross-domain tracking setup. Then hit save.

That’s it. You don’t need to configure the referral exclusion list for this. GA will handle that automatically. However, if for some reason, you see your own domains as traffic sources, then you can configure unwanted referrals.

Note: this will also affect your automatic outbound click tracking in Enhanced Measurement. Domains that you enter here will no longer be treated as outbound clicks.

Subscribe and Get the Ebook - working with reports in ga4

Test the setup

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.

Then, you can also enable the GA Debugger extension and go to the DebugView of Google Analytics 4. There, you should find your device, and once you do that, you should see that you have at least several page_view events. In some events, the page_location parameter will contain the domainA.com. And in other events, it will contain the domainB.com.

That is the final result you should be looking for.

 

Keep the redirects in mind

If the URL on domainB.com does not contain _gl parameter, there might be a JavaScript redirect somewhere along the way. Try using the extension Redirect Path to identify problems.

Install the plugin, then go to domainA.com and click the link to domainB.com. Then click on the Redirect Path extension and see if the _gl parameter was there. If it was at first, but then was lost, you should talk to your developers and ask them to debug this further. The goal here is to persist that _gl parameter.

 

Cross-domain tracking is not working?

Even if you followed all the steps explained in this guide, sometimes mistakes happen (or maybe some external factor was not taken into account). To help you with that, I have prepared a troubleshooting guide: what to do when GA4 cross-domain tracking is not working.

Subscribe and Get the Ebook - Increase data accuracy in google analytics 4

Frequently asked questions

Some of these questions were already covered in this blog post, but I will still list them here (because not everyone carefully reads every paragraph). So here’s the TL;DR version.

 

What is cross-domain tracking in Google Analytics 4?

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/domains.

 

Why is cross-domain tracking important?

Without it, the number of your visitors would increase and be less accurate. Also the number of sessions will increase because when the visitor navigates to the second domain, a new session will be started (because GA treats this as a different user).

 

Do I need cross-domain tracking for subdomains?

No, if you are talking about the subdomains of the same domain. Google Analytics 4 (and previous versions) is capable of tracking visitors across subdomains. So, you don’t need to do any additional configuration.

 

Do I need to configure the referral exclusion list for cross-domain tracking in Google Analytics 4?

No, Google Analytics 4 handles self-referrals automatically based on the domains that you entered in the “Configure your domains” section (source). A referral exclusion list is needed for things like payment gateway domains, etc.

 

How do I test cross domain tracking?

You can verify your cross domain setup by clicking the link on the first website (that redirects you to the second website). The URL of the second website should contain the _gl= parameter. Also, you can check if the _ga cookie is the same.

Take a look at the screenshot below and perform this check on both domains. The _ga cookie’s value must be the same on both domains. Also, keep an eye on the “Domain” column of the cookie list.

 

Google Analytics 4 Cross Domain Tracking: Final words

Cross-domain tracking in GA4 is quite simple. However, it also has some limitations.

This feature in GA4 works only if a visitor jumps between two domains after a link click. It won’t work with button clicks (if they are coded as <button> HTML elements). It won’t also work for form submissions.

There have been posted some workarounds, but they are reverse-engineered. It’s possible that they will stop working one day just because Google changed something on their end.

 

Julius Fedorovicius
In Google Analytics Tips
41 COMMENTS
Mahmoud
  • Nov 30 2021
  • Reply

Hi Julius
Thank you for your article

how can organize multiple websites on the same domain ?
we made multiple websites (all websites is the same and just different in languages ) that are published in the same domain and separated by folder like example.com/en, example.com/fr , ...

At this moment we made some tags that have different trigger, due to the folder name in URL so we made many properties in Google Analytics for each website..

Is it good idea? or we should chose better strategy, Since I am junior in data analytics, I don't know is it suitable for analysis or I put all of websites in a one analytics proprerty

What do you recommend?

    Julius Fedorovicius
    • Dec 1 2021
    • Reply

    Without knowing the full context it is difficult to provide the best solution. It should definitely be a single GA4 property. But as for how many GTM containers should be there - that depends. Very likely that one container will be enough (but there might be some exceptions)

Keyvan
  • Mar 31 2022
  • Reply

You mention that for CDT both domains need to be under the same data stream but later you say they should be under the same propert (as in they can be in different data streams) Which one is true? can we setup CDT between multiple datastreams within the same propert?

    Julius Fedorovicius
    • Mar 31 2022
    • Reply

    The latest recommendation from google is to use the same data stream

      Keyvan
      • Mar 31 2022
      • Reply

      Ok thank you. Do you have any tips on how to (separately) visualize data from different domains under the same data stream?(something to have in mind when setting up the config tag for the target domains in gtm maybe?)

        Julius Fedorovicius
        • Mar 31 2022
        • Reply

        Use comparisons and segments. More specific steps are available in my GA4 course https://www.analyticsmania.com/courses/google-analytics-4-course/

          Keyvan
          • Mar 31 2022

          Will do! thank you! You are doing god's work :)

Matej
  • Apr 21 2022
  • Reply

Hi Julius.

Thanks for another perfect article.
Just to be crystal clear. In cross domain tracking do domain-A and domain-B have the same GTM code installed?

Thanks in advance for answer.

    Julius Fedorovicius
    • Apr 21 2022
    • Reply

    Containers don't matter

Jhun
  • May 3 2022
  • Reply

I'm migrationg from UA to GA4 and one issue I need to fix is the cross-domain tracking. With this article, I need not to worry about it anymore. :D Very helpful guide.

Also, on another topic, would you also create an article in the coming weeks about filtering subdirectories or is it really not availablein GA4 (like a blog in the same domain /blog?) Do you think it's advisable to have a separate measurement ID for this situation? Thank you, Julius!

    Julius Fedorovicius
    • May 6 2022
    • Reply

    No plans for a public guide. But I talk a lot about this in my GA4 course https://www.analyticsmania.com/courses/google-analytics-4-course/

Long
  • May 23 2022
  • Reply

Hi Julius.

I have a question. We have a website with 2 subdomains. For example sub1.mywebsite.com and sub2.mywebsite.com. So in he Pages and Screens report of GA4, would they appear as the same Page path?

    Julius Fedorovicius
    • May 25 2022
    • Reply

    Yes

Oguz Erol
  • Jun 2 2022
  • Reply

after implementing cross domain tracking by GA4 interface, should i still use GTM interface? I mean this setting: "Enable linking across domains", "auto link domains", "A.com, B.com" Should i do this setting on gtm interface to make for example something on google ads work? Or is it useless after configuring cross domain from GA4 interface?

    Julius Fedorovicius
    • Jun 3 2022
    • Reply

    GA4 configuration is enough for most cases. But if you are also using the Google Ads remarketing tags in GTM, conversion linker is also needed.

    I have already replied to this comment on my Youtube channel. Please don't send the same message through multiple channels, it's very difficult to keep the conversation.

Jessica
  • Aug 25 2022
  • Reply

Hi Julius,

Will setting up cross domain tracking this way also work in reverse? Meaning if i set up a webstream for example.com and set up cross domain tracking with conditions for example.com and example2.com will the cross domain tracking still work if a user begins their journey on example2.com and then lands on example.com and vice versa. Thanks for your help!

    Julius Fedorovicius
    • Sep 19 2022
    • Reply

    Enter both domains in the settings and this will work

Hosein
  • Sep 18 2022
  • Reply

Hi Julius.
I think cross domain tracking in ga4 also working when two domains have two data streams but in one property.
I mean it does not need one data stream and one measurement ID.
do you approve that?

    Julius Fedorovicius
    • Sep 22 2022
    • Reply

    Technically, yes. But Google's recommendation is to use same stream. My guess is that separate streams might cause issues with sessions because every web stream sets some unique cookies

MWatson
  • Nov 17 2022
  • Reply

Is there a way for us to have the parameter captured on the page, outside of the URL so it isn't visible to users?

    Julius Fedorovicius
    • Nov 17 2022
    • Reply

    No robust way

Vishal
  • Feb 5 2023
  • Reply

Hi Julius, Thanks for this post.

I have a query.
Do we need to configure cross domain for following scenario

www.example.com
www.example.ca

Thanks

    Julius Fedorovicius
    • Feb 9 2023
    • Reply

    Yes

Hamid
  • Jun 12 2023
  • Reply

Hi Julius,
Thanks for this post.

After we have made these settings, how can I prepare a report separately from different domains? (in standard reports or explorer reports)

    Julius Fedorovicius
    • Aug 3 2023
    • Reply

    I teach various options in my GA4 course https://www.analyticsmania.com/courses/google-analytics-4-course/

Oxana
  • Aug 6 2023
  • Reply

Hi, Thank You for post. And one more question.
What about Google Console and cross-domen traction?

Which Google Console page connect to cross-domains GA4.
Because there are only option to connect 1 Gooogle Console page to GA4.

Thank you in advance 😊

    Julius Fedorovicius
    • Aug 7 2023
    • Reply

    Choose whatever is most important to you. Personally, I don't find this a problem because, in my opinion, Google Search Console interface is better for analysis and I use it primarily to check the keywords, etc.

Thea
  • Aug 24 2023
  • Reply

What if you have two domains on different data streams and you want to track conversions from domain two - is there a way to show these as conversions on domain one?

Mark K
  • Aug 24 2023
  • Reply

Hello Julius - thank you as always.

Quick question - using cross domain tracking, am I able to carry the "timer" tag across multiple domains?

I want to track when sessions duration exceeds 30, 60, and 120 seconds, but the timer is resetting each time a new page loads, or they move between domains.

Tom J
  • Aug 29 2023
  • Reply

If I want to cross track 3 domains and am using GTM do I put the same container code into all 3 sites?

    Julius Fedorovicius
    • Aug 31 2023
    • Reply

    GTM code does not matter. GA4 tracking code does.

Naveen
  • Aug 31 2023
  • Reply

Hi Julius,
If the user going from www.abc.com to www.abc.xyz.com. then Google will consider it as outbound link or internal link click.
(the user from 1st domain has clicked the button and went to 2nd domain i.e. www.abc.xyz.com))

Klara
  • Oct 6 2023
  • Reply

Hi! I've got a site where the languages of the site has different domains, for example company.com , company.nl . Can I use the same Data stream for those two and set up cross-domain for the stream? I tried to do that, but the Analytics tag will not appear on the second site. How should I set it up?

Deepak
  • Oct 27 2023
  • Reply

Hi Julius,

Is it possible to maintain cross-domain tracking without having excessively long "_gl" values in the URL?

Roberto
  • Nov 14 2023
  • Reply

Hello Julius!
Thanks for your lesssons, I need I more lesson.
How Can I solve javascript redirect without access to develop player?? ^_^
And I can't load domainB in iframe, domainB blocked.

Jakub
  • Feb 21 2024
  • Reply

Hi Julius,
I am struggling with the cross-domain setup. When I enter all domains that should be included in the cross-domain tracking for example: domainA.com and domainB.com the "_gl" parameter is being added on the subdomain level of domainA.com. The links are decorated with this parameter which is obtrusive to the website UX.
Is this common or an an issue?
Thanks!

Veeresh Mattigajam
  • Apr 14 2024
  • Reply

Hi Julius,

We have implemented cross domain tracking in GA4, but we don't see _gl in domain B url, but we can see _ga in the url and also most of the traffic is attributed to direct traffic, may I know how we can solve this.

Fahad
  • Apr 18 2024
  • Reply

I have a website that have embed typeform. When user submits that form it redirects to our sub domain or back to main domain based on user response. Do we need to setup cross domain tracking for that?

Mike
  • Apr 26 2024
  • Reply

Hey Julius,

thanks for the good instructions. How would you proceed if you still wanted to analyse the traffic from domain A to B, for example? Is that even possible?

Greetins
Mike

Sanjeev Kumar
  • May 10 2024
  • Reply

Hi,

I have implemented the cross-domain tracking by using another property and adding the Gtag to the respective containers of the two websites in GTM.

However, I am not getting all the events in the cross-domain tracking property. Could you tell me what the reason for that is?

I am getting the default events in the cross-domain tracking property but not from the individual container

Thanks

Rupal
  • May 22 2024
  • Reply

Hello Sir,

I have multiple site location wise. User comes from the different sites but one site for purchase the products. When user do the add to cart then redirect to common site where the user purchase the products.

In this case what to do? Please Guide

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *


 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and Google Analytics. Join thousands of other digital marketers and digital analysts in this exciting journey. Read more
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
Recent Posts
  • Conversion rate in Google Analytics 4
  • Google Tag Manager Data Layer Explained
  • Cross-domain tracking in Google Analytics 4
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings