What is Cross Domain Tracking in Google Analytics?

Cody Schneider8 min read

Ever noticed a traffic source in Google Analytics labeled "(direct)" or saw a brand's own website listed as a top "referral"? This often points to a broken user journey, a common problem when your customer's path involves more than one domain. This is where cross-domain tracking comes in, ensuring you see the full picture from start to finish. This guide will walk you through what it is, why it’s essential, and how to set it up correctly in Google Analytics 4.

GraphedGraphed

Your AI Data Analyst to Create Live Dashboards

Connect your data sources and let AI build beautiful, real-time dashboards for you in seconds.

Watch Graphed demo video

What is Cross-Domain Tracking? (And Why You Need It)

Cross-domain tracking allows Google Analytics to see sessions on two or more related sites as a single session. In simple terms, it "stitches together" a user's journey when they navigate from one domain you own to another, like from your main website to a separate e-commerce checkout site.

To understand why this is so important, you need to know how Google Analytics tracks users. GA uses a first-party cookie stored in the user's browser to assign a unique identifier called a Client ID. This ID is how GA recognizes a returning user and groups all their on-site actions (pageviews, events) into a single session.

Here’s the catch: these cookies are tied to a specific domain. When a user clicks a link from yourwebsite.com to yourcheckoutpartner.com, Google Analytics on the second domain can't access the cookie from the first. It treats this as a brand new visitor, assigns them a new Client ID, and starts a new session.

The result is a broken journey:

  • Lost Attribution: If that user originally came from a Facebook ad or an organic search result, that crucial source information is lost. The new session on the second domain will be attributed to "Referral" traffic from yourwebsite.com, or worse, "(direct) / (none)" if referral data isn't passed correctly. Your Facebook ad campaign's ROI now looks terrible because the final conversion isn't linked back to it.
  • Inflated User Counts: A single person making one purchase is counted as two separate users, which skews your audience metrics.
  • Inaccurate Behavior Analysis: You can't analyze the full funnel because GA sees two disconnected halves of a journey instead of one seamless path. You can't see which landing pages on your main site lead to the most checkouts on your payment site.

Cross-domain tracking solves this by passing the original Client ID from the first domain to the second. This tells GA, "Hey, this is the same user continuing their session," preserving the original source, medium, and campaign data all the way to conversion.

Free PDF Guide

AI for Data Analysis Crash Course

Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.

Common Scenarios for Cross-Domain Tracking

You might need cross-domain tracking if your user’s journey looks like any of these common examples:

  • Third-Party Shopping Carts: This is a classic. Your main e-commerce storefront is on mystore.com, but when a customer clicks "Checkout," they are sent to securecheckout.com to complete their purchase.
  • Booking and Reservation Systems: A hotel website at besthotelstay.com might use an external service like book-now-engine.com to handle room reservations.
  • Separate Blog or Content Hub: You run your main corporate site at mycompany.com but host your popular blog on a different domain, such as mycompanycontent.com, to use a specific content management system.
  • Lead Gen and Marketing Automation: A visitor on ourcoolsaas.com clicks a "Request a Demo" button and is taken to a landing page hosted by a marketing automation platform like info.hubspot.com/ourcoolsaas/demo.
  • Event Registration Platforms: Your event promotional page is on annualconference.com, but the registration and ticket-buying process happens on eventbrite.com.

In all these cases, without cross-domain tracking, you lose visibility the moment a user leaves your primary domain.

How it Works: A Simple Explanation

So how does Google Analytics magically link these sessions? It does it by adding a special parameter to the URL when a user clicks a link that goes from one of your specified domains to another.

This is often called a "linker parameter." In GA4, it looks something like this:

?_gl=1*abcde*...

When you set up cross-domain tracking, GA automatically detects clicks on links pointing to your other domains. Before sending the user to the destination page, it appends this _gl parameter to the URL. This parameter contains the user's Client ID and current session information.

When the user lands on the second domain, the Google Analytics tag on that page is smart enough to see the _gl parameter in the URL. It reads the Client ID from it and uses that one to initialize the tracking, instead of creating a new one. The result is one continuous session in your analytics reports.

GraphedGraphed

Your AI Data Analyst to Create Live Dashboards

Connect your data sources and let AI build beautiful, real-time dashboards for you in seconds.

Watch Graphed demo video

Step-by-Step: Setting Up Cross-Domain Tracking in GA4

Thankfully, setting up cross-domain tracking in GA4 is much easier than it was in Universal Analytics. The entire process is managed within the GA4 admin interface, without needing to touch code directly in most cases.

Prerequisite: Before you start, make sure the same GA4 Measurement ID (e.g., G-XXXXXXXXXX) is installed on all the domains you want to track. The easiest way to manage this is with a single Google Tag Manager container installed on every page of every site.

Step 1: Navigate to Your Data Stream Settings

  1. Log in to your Google Analytics 4 account.
  2. Click on Admin in the bottom-left corner (the gear icon).
  3. In the Property column, make sure your correct GA4 property is selected.
  4. Click on Data Streams and select your web data stream.

Step 2: Configure Your Domains

  1. On the Web stream details page, scroll down and click on Configure tag settings.
  2. Under the Settings section, click on Configure your domains. This is where the magic happens.
  3. Click the Add condition button.
  4. Leave the Match type as "Contains." This is typically the most flexible option.
  5. In the Domain field, enter the first domain (e.g., mystore.com). Do not include "https" or "www."
  6. Click Add condition again and add your second domain (e.g., securecheckout.com). Repeat for any other domains in the user journey.
  7. Once all domains are added, click Save.

Your configuration screen should look something like this, listing all domains involved in the user journey.

Step 3: Add Your Domains to the Unwanted Referrals List

This is a critical step that prevents GA4 from self-referrals. A self-referral happens when traffic from your second domain (securecheckout.com) back to your first domain (mystore.com) is reported as referral traffic. We want GA4 to ignore these internal movements.

  1. Go back to your Configure tag settings screen (Admin > Data Streams > Your Stream > Configure tag settings).
  2. Click Show more to reveal more options.
  3. Click on List unwanted referrals.
  4. Similar to the previous step, click Add condition.
  5. Set the Match type to "Referral domain contains" and enter your first domain (e.g., mystore.com).
  6. Repeat this for all other domains you configured for cross-domain tracking.
  7. Click Save when you're finished.

And that’s it for the GA4 setup! The "linker" parameter will now be added automatically to any URLs that cross between the domains you have configured.

Free PDF Guide

AI for Data Analysis Crash Course

Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.

How to Verify Your Cross-Domain Tracking is Working

Don't just set it and forget it. It's important to verify that everything is working correctly. Here are a couple of straightforward ways to test your setup.

Method 1: Check the URL for the Linker Parameter

This is the quickest and most reliable test.

  1. Go to your first domain (e.g., https://www.mystore.com).
  2. Click on a link that should take you to your second domain (e.g., the "Checkout" button).
  3. Look at the URL in your browser's address bar once you land on the second domain.
  4. You should see the _gl=... parameter appended to the end of the URL. It will look like a long string of numbers and letters, for example: https://www.securecheckout.com/cart?item=123&_gl=1~1abcd2e~...

If you see that parameter, it means GA4 is correctly passing the client ID.

Method 2: Use GA4's Realtime Report

The Realtime report can give you visual confirmation that GA4 is tracking you as a single user across both domains.

  1. Open your GA4 Realtime report (Reports > Realtime).
  2. In a separate browser window, go to your first domain. You should see yourself appear on the map and in the "Users in Last 30 Minutes" card.
  3. Now, navigate from your first domain to your second domain using one of the links you want to track.
  4. Watch the Realtime report. You should remain a single active user in the report — you won't see a second user pop up. The page titles or event names in the event stream will change from those on the first domain to those on the second, confirming that GA4 is tracking your journey seamlessly.

Final Thoughts

Setting up cross-domain tracking is fundamental for getting trustworthy data in Google Analytics. Without it, your attribution is broken and you're making decisions based on an incomplete view of the customer journey. By connecting the dots between your different web properties, you can properly credit your marketing channels and understand what drives results.

Consolidating your analytics is just the first step. When you also have campaign data in Facebook Ads, customer info in Salesforce, and purchase history in Shopify, the challenge becomes seeing the entire journey, not just the website portion. That's why we built Graphed. We make it simple to connect all your data sources in one place. Instead of spending hours in GA trying to stitch together reports, you can just ask questions in plain English — like "Show me the full customer journey from the first ad-click in Facebook to the final sale in Shopify" — and get an instant, real-time dashboard that tells the full story.

Related Articles