Data & Analytics

Cross-Domain Tracking in Google Analytics 4: A Complete Guide

Tracking users across multiple websites or domains can be tricky -but it’s essential for understanding user journeys, especially for businesses with checkout domains, blog subdomains, or third-party tools. With Google Analytics 4 (GA4), cross-domain tracking is easier and more reliable than ever- if you configure it correctly.

In this guide, you’ll learn what cross-domain tracking is, how it works in GA4, how to set it up, and how to troubleshoot common issues.

The Problem of Multiple Domains

Imagine this scenario:

  • A user lands on your marketing site: www.brandsite.com
  • Then clicks “Shop Now” and is redirected to your store on store.brandsite.com or checkout.partnerplatform.com
  • Finally, they complete a purchase

Without cross-domain tracking, GA4 will treat each domain as a separate session and a new user. That breaks the user journey and makes it impossible to attribute conversions properly.

What is Cross-Domain Tracking in Google Analytics 4?

Cross-domain tracking ensures that user sessions are preserved when someone moves between your domains. It stitches together pageviews, events, and conversions across domains as part of a single user journey.

In GA4, this is achieved automatically through enhanced tagging and configuration without needing custom JavaScript like in Universal Analytics.

How Does Cross-Domain Tracking Work in Google Analytics 4?

GA4 uses the client ID (stored in the _ga cookie) to identify users. When cross-domain tracking is configured, GA4 appends a special query parameter (_gl) to your URLs. This parameter carries user/session information.

Subscribe to our mailing list to get the new updates!

No worries, we always share helpful content.

When a user clicks from Domain A to Domain B:

  • The _gl parameter is added to the link
  • Domain B reads that parameter
  • GA4 stitches the sessions together, maintaining the user identity

✅ Result: You get accurate attribution, longer session duration, and proper conversion tracking across domains.

Will Google Analytics Track Subdomains?

Yes, GA4 tracks subdomains by default.

You do not need to configure cross-domain tracking if your site structure is like:

  • www.brand.com
  • blog.brand.com
  • shop.brand.com

These are all under the same root domain, and GA4 handles them automatically.

However, if your users move between:

  • brand.com → brandstore.com
  • example.com → checkout.examplepayments.com

Then cross-domain tracking is required.

How to Configure Cross-Domain Tracking in Google Analytics 4

You can set this up in Google Tag Manager (GTM) or directly in GA4’s admin interface (if you’re using the gtag.js setup). Here’s how to do it via GTM (recommended):

Step 1: Open Your GA4 Configuration Tag

  • Go to Google Tag Manager
  • Click on your GA4 Configuration Tag
  • Scroll to Fields to Set

Step 2: Enable Cross-Domain Tracking

  1. Click More Settings > Cross Domain Tracking
  2. Under Auto Link Domains, enter the domains you want to track (e.g., brandsite.com, brandcheckout.com)
  3. Set Decorate Links to true

Step 3: Add Linker Plugin Support (Optional for Advanced Cases)

If you’re linking through buttons or dynamic elements, use event delegation or gtag(‘set’, ‘linker’, …) calls manually for custom links.

Test the Setup

  1. Go to GA4 DebugView (via Admin > DebugView)
  2. Open your site in a tab with GA Debugger Chrome extension active
  3. Navigate from Domain A to Domain B
  4. Check that the session ID and user ID remain the same

You can also manually verify the _gl parameter is appended in the browser address bar during redirection.

Keep the Redirects in Mind

Cross-domain tracking breaks if:

  • A server-side redirect strips the _gl parameter
  • The link opens in a new tab and the target page fails to read the parameter
  • There’s no click event (e.g., auto-redirect without user action)

To maintain session continuity:

  • Avoid unnecessary redirects
  • Use client-side navigation where possible
  • Whitelist the parameter if your platform strips unknown query parameters

Cross-Domain Tracking is Not Working?

Here’s a checklist:

✅ Did you list all domains in the Auto Link Domains list?
✅ Is the _gl parameter showing up in the URL when navigating?
✅ Are both domains using the same GA4 Measurement ID?
✅ Are you testing in incognito mode with GA Debugger enabled?
✅ Are any redirects stripping URL parameters?

Still not working? Use Google Tag Assistant or Network tab in Developer Tools to trace tracking events.

Frequently Asked Questions

What is cross-domain tracking in Google Analytics 4?

It’s the process of linking user sessions across multiple domains so you can see the full customer journey from source to conversion in one session.

Why is cross-domain tracking important?

Without it, GA4 will break a user’s session when they navigate to a different domain, leading to incorrect attribution, inaccurate metrics, and poor insights.

Do I need cross-domain tracking for subdomains?

No, GA4 handles subdomains automatically. You only need to set up cross-domain tracking for separate root domains.

How do I test cross-domain tracking?

Use GA DebugView or inspect the _gl parameter in URLs. Also compare session source/medium before and after the domain transition. They should remain consistent.

Wanna see how your website perform?

Let's run a comprehensive technical SEO audit for your website and share a compelling SEO strategy to grow your online business.

SEO Audit →

Related Articles

Back to top button