How to Set Up Cross Domain Tracking in Google Analytics 4

Cody Schneider8 min read

Tracking the customer journey across multiple websites you own - like your main site and a separate shopping cart domain - can feel unnecessarily complex. Without the right setup in Google Analytics, GA4 sees a user who clicks from yourbrand.com to yourstore.com as two different people, breaking the session and destroying your conversion data. This guide walks you through the step-by-step process of setting up cross-domain tracking in GA4 to get a single, unified view of your user's path.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What is Cross-Domain Tracking and Why Do You Need It?

In simple terms, cross-domain measurement allows Google Analytics to see a session that occurs across two or more related sites as a single session. It stitches the user's journey together, ensuring you have accurate data on behavior, referrals, and conversions.

Modern businesses often run on more than one domain. Here are a few common scenarios where cross-domain tracking is essential:

  • Primary Site and E-commerce Store: Your marketing site is at mycoolbrand.com, but your e-commerce platform (like Shopify or a hosted cart) is at shop.mycoolbrand.com or mycoolbrand.myshopify.com.
  • Marketing Site and Booking Portal: Your main website showcases your services, but when users click "Book Now," they're sent to a third-party domain like securebookings.com/mycoolbrand.
  • Content Blog and Main Application: Your blog lives on blog.startup.io to attract users with content, and your main web app is at app.startup.io.

Without cross-domain tracking, each time a user moves from one of your domains to another, GA4 ends the first session and starts a new one. This leads to major reporting problems:

  • Skewed Session Counts: One real visitor journey across two sites gets counted as two separate sessions, inflating your numbers.
  • Loss of Attribution: If a user comes from a Facebook Ad to your first domain, then moves to your second domain to purchase, the second domain will report the traffic source as a "Referral" from your first domain. You completely lose the original attribution, making it impossible to know if your campaigns are actually working.
  • Broken User Journeys: You can't see the full user path from first touch to final conversion, preventing you from identifying friction points and improving user experience.

By correctly setting up cross-domain tracking, you solve all of these issues. GA4 will correctly understand that the user visiting both domains is the same person in the same session, giving you a clean and accurate picture of their full journey.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

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

The good news is that GA4 has made this process much simpler than its predecessor, Universal Analytics. You no longer need to manually modify tracking codes or deploy complex setups in Google Tag Manager for basic configurations. The entire setup is handled within the GA4 admin interface.

The magic happens through a URL parameter called _gl. When a user clicks a link from your first domain to your second, GA4 automatically adds this special parameter to the URL. The parameter contains a unique identifier that tells the GA4 property on the second domain, "Hey, this is the same user from the previous page." It ensures a seamless hand-off.

Let's walk through the steps to get this working.

Step 1: Go to Your Admin Settings

Log in to your Google Analytics 4 property. In the bottom-left corner, click on the gear icon for Admin.

Step 2: Navigate to Your Data Stream

In the Property column, you’ll find Data Streams. This is where Google Analytics gets its data from your website. Click on it, and then select the web data stream you want to configure (you likely only have one).

Step 3: Access Tagging Settings

Once you are in your web stream details, scroll down to the bottom section called Google tag. Here, click on Configure tag settings.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 4: Configure Your Domains

In the Settings screen, click on Configure your domains. This is where you will tell GA4 which websites are part of the same business and should share session information.

Now, you'll see a section to add your domains. Click the Add condition button.

Here you’ll need to do the following for each domain in the user journey:

  1. Set the Match Type: Your best bet for most situations is contains. It’s flexible and avoids issues with subdomains (www, shop) or different URL structures.
  2. Enter the Domain: Type in the domain you want to track (e.g., mycoolbrand.com). You don't need to include https://, www, or forward slashes.

For example, if your journey starts at mycoolbrand.com and ends at securebookings.com, you would add two conditions:

  • Condition 1: Match type: contains | Domain: mycoolbrand.com
  • Condition 2: Match type: contains | Domain: securebookings.com

It's vital to include every single domain that is part of the user journey. If the user moves from Domain A to B to C, but you only list A and C, tracking will break at domain B.

Once you have added all your domains, click the Save button in the top right corner.

Step 5: Check Your Unwanted Referrals List

There's one final checkup. Go back to the "Configure tag settings" screen. This time, click Show more to expand the list of configuration options. Then, click on List unwanted referrals.

This setting tells GA4, "Don't treat traffic coming from these domains as a New User via referral." It prevents mycoolbrand.com from showing up as the referrer for sessions on securebookings.com.

When you configured your domains in the previous step, GA4 should have automatically added them here. However, it’s always a good practice to verify this. Your rule should be set to "Referral domain contains" and your domains should be listed below. If one is missing for some reason, you can add it manually here.

How to Test If Cross-Domain Tracking Is Working

After saving your settings, it's time to confirm everything is working as expected. Don’t just assume it’s working - always test it.

Here are two easy ways to verify your setup.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 1: Check for the _gl Linker Parameter

This is the quick and easy way.

  1. Open your primary domain in your browser. A private/incognito window is a good idea to ensure you are seen as a new user.
  2. Navigate to a page that contains a link to your second domain.
  3. Click that link.
  4. Once the second domain loads, look closely at the URL in your browser's address bar.

You should see a _gl parameter attached to the URL. It will look something like this:

https://securebookings.com/?_gl=1*1nht4w3*_ga*MTc...

If you see that parameter, your setup is working! GA4 successfully decorated the URL and passed the client ID from one domain to the next.

Method 2: Use GA4's DebugView

For a more advanced confirmation, you can use the built-in DebugView in Google Analytics.

  1. Install the Google Analytics Debugger extension for Chrome. Once installed, turn it ON by clicking its icon.
  2. In GA4, navigate to Admin > DebugView.
  3. In your original browser tab (with the debug extension on), go to your primary domain and click around. You will see your activity appear in DebugView in real-time.
  4. Find the session_start event and check for a parameter named ga_session_id. Take note of its value.
  5. Now, click a link that takes you to your second domain.
  6. Watch DebugView for new events coming from your second site. Check for the ga_session_id parameter on those events. It should have the exact same value.

If the session ID stays the same as you move from one domain to another, it's definitive proof that GA4 is treating the behavior as one continuous session.

Common Problems and Troubleshooting Tips

If things aren't working, here are a few common causes:

  • Typos in Domains: The most common error is a simple typo when entering domain names in the GA4 configuration. Double and triple-check your spelling.
  • Missing Domains: You must list every domain involved in the cross-domain path.
  • URL Redirects Scraping Parameters: Some website configurations (or redirects) can be aggressive and strip all parameters from a URL when the new page loads. If you see the _gl parameter appear for a split second and then vanish, this is likely the issue. You may need a developer's help to configure your server to allow the _gl parameter.
  • Long Lag Time: Sometimes changes in the GA4 admin interface can take up to 30 minutes to an hour to take effect. If you've just saved your changes, grab a coffee and come back to test it again in a little while.

Final Thoughts

Setting up cross-domain tracking is no longer a daunting task for data-driven teams. By taking a few minutes to configure your domains correctly inside the GA4 interface, you can eliminate broken data and gain a crystal-clear understanding of the complete user journey, from initial interest to final conversion.

Once your GA4 property is accurately collecting unified cross-domain data, the next critical step is turning that raw data into clear, actionable insights. Making sense of complex user paths and building insightful reports can still be time-consuming. We built Graphed to solve this by allowing you to simply ask for what you need in plain English. Instead of navigating complicated reporting screens, you can ask questions like, "Show me the top traffic sources leading to a purchase across my website and my Shopify store," and get an instant real-time dashboard that answers your question in seconds.

Related Articles