Skip to content
Back to blog
GA4Mar 5, 2026 · Ludde Nyström · 7 min read

GA4 Cross-Domain Tracking: Setup, Testing, and Common Pitfalls.

How to configure GA4 cross-domain tracking properly to fix GA4 sessions breaking across domains. Includes a robust methodology to test your cross-domain setup.

GA4 Cross-Domain Tracking: Setup, Testing, and Common Pitfalls

Cross-domain tracking in GA4 solves a specific problem: when your user journey spans multiple domains (e.g., shop.example.com to checkout.example.com), GA4 treats each domain as a separate session by default. This fragments the user journey and breaks attribution — the referral from your own domain appears as a new traffic source, making it impossible to understand how users convert across your properties.

GA4 handles cross-domain tracking differently from Universal Analytics, and many teams either haven't configured it correctly or have over-configured it for domains that don't need it. This guide explains when you actually need cross-domain tracking, how to set it up properly, and the subtle issues that can corrupt your data if you get it wrong.

Skip the manual check: the cross-domain tracking audit reads every distinct hostname GA4 has seen in the last 30 days, inspects your GTM linker config, and flags exactly which boundary is leaking — in 60 seconds, no GA4 docs required.

Why Cross-Domain Tracking Matters

When Do You Actually Need Cross-Domain Tracking?

Cross-domain tracking is needed when all three of these conditions are true:

  1. Users navigate between different domains (not subdomains) as part of the same journey.
  2. Both domains are tracked by the same GA4 property (same Measurement ID).
  3. You want to track the user as a single session across both domains.

Common scenarios that require cross-domain tracking:

  • Main site (example.com) → Third-party checkout (shop.shopify.com/example)
  • Marketing site (example.com) → App/dashboard (app.example.io)
  • Regional sites (example.co.uk) → Global checkout (store.example.com)

Important: Subdomains (e.g., blog.example.com and shop.example.com) do not require cross-domain tracking. GA4 uses first-party cookies scoped to the root domain, so subdomains are automatically tracked in the same session. Setting up cross-domain tracking for subdomains is a common mistake that adds unnecessary complexity.

How GA4 Cross-Domain Tracking Works

Unlike Universal Analytics, which required manual linker configuration in GTM, GA4 handles cross-domain tracking through the Admin → Data Streams → Configure Tag Settings → Configure Your Domains interface. Here's what happens under the hood:

  1. When a user clicks a link from Domain A to Domain B, GA4 appends a _gl parameter to the URL containing the client ID and session information.
  2. When Domain B's GA4 tag loads, it reads the _gl parameter and uses the client ID from Domain A instead of generating a new one.
  3. Both page views are attributed to the same user and same session, preserving the conversion path.

This linker parameter approach means the user's identity is passed through the URL itself — no server-side communication is needed. However, it also means the _gl parameter must survive the redirect. URL shorteners, certain redirect services, and some WAFs (Web Application Firewalls) strip unknown query parameters, breaking the chain.

Cross-domain check included

NiceLookingData detects cross-domain tracking misconfigurations, self-referrals, and missing linker parameters. Scan your property →

How to Configure Cross-Domain Tracking

Step 1: Configure Domains in GA4 Admin

  1. Go to Admin → Data Streams and select your web stream.
  2. Click Configure Tag Settings (at the bottom of the stream details).
  3. Click Configure Your Domains.
  4. Add each domain that participates in cross-domain tracking. Use the "contains" match type for simplicity (e.g., example.com will match shop.example.com, blog.example.com, etc.).
  5. Click Save.

Step 2: Verify Both Domains Have the Same Measurement ID

Both domains must be sending data to the same GA4 property (same Measurement ID). Check your GTM containers or gtag.js implementations on both domains to ensure the Measurement ID matches. A common mistake is having Domain B use a different GA4 property — cross-domain tracking won't work across different properties.

Step 3: Update Referral Exclusions

By default, when a user navigates from Domain A to Domain B, Domain A appears as a referral source for Domain B. This creates self-referrals in your traffic source reports. To fix this:

  1. Go to Admin → Data Streams → Configure Tag Settings → List Unwanted Referrals.
  2. Add all your domains to the unwanted referral list (also called the referral exclusion list). This tells GA4 not to create new sessions when traffic comes from these domains.

Without this step, you'll see your own domains appearing as top referral sources in your acquisition reports — a clear sign that cross-domain tracking isn't fully configured.

How to Configure Cross-Domain Tracking in GTM

If you're deploying GA4 via Google Tag Manager rather than directly with gtag.js, the domain configuration happens in a slightly different place. The recommended approach is to configure it in the GA4 Admin UI (as described above), since GA4 Admin settings apply globally to all tags using that Measurement ID regardless of how they're implemented. However, you can also configure cross-domain domains directly in the GA4 Configuration tag in GTM:

  1. Open your GTM container and navigate to your GA4 Configuration tag (the tag that sets the Measurement ID).
  2. Expand Fields to Set and add a field named linker with a value of the domains object, or use the built-in Cross Domain section if your GTM version surfaces it.
  3. Alternatively, and more reliably, configure domains in the GA4 Admin UI and let GA4 handle the linker automatically — this avoids GTM config drift where the tag and the property disagree.
  4. Publish the GTM container after any changes.

A common source of confusion: teams configure cross-domain domains in GTM but forget the unwanted referral list in GA4 Admin, or vice versa. Both need to be set for sessions to stitch correctly and for self-referrals to be suppressed.

Common Issues and How to Diagnose Them

How to Know If Cross-Domain Tracking Is Broken

Cross-domain tracking issues are silent — you won't get error messages. The symptoms show up in your reports, not in the tag console. Watch for these signals:

  • Your own domains appear as top referral sources. In GA4 → Traffic Acquisition, if you see example.com or checkout.example.com listed as a referral, sessions are being fragmented on cross-domain navigation.
  • Conversion paths are cut short. If your funnel reports show users dropping off at the exact point where they cross domains, the session is being reset rather than continued.
  • The _gl parameter is missing from cross-domain URLs. Navigate from Domain A to Domain B and inspect the URL in the address bar. A properly configured setup appends ?_gl=... to the destination URL.
  • Client IDs differ across domains. Open Chrome DevTools on both domains, inspect the _ga cookie value. If the client IDs don't match after a cross-domain navigation, stitching failed.

Common Problems and Fixes

  • Self-referrals in reports: You forgot to add domains to the unwanted referral list. Go to Admin → Data Streams → Configure Tag Settings → List Unwanted Referrals and add all your domains.
  • The _gl parameter is stripped: Some URL redirect services, CDNs, or JavaScript routers strip query parameters during navigation. Test the full redirect chain to identify where parameters are being lost.
  • Different Measurement IDs: Both domains must use the same GA4 Measurement ID. A common mistake with acquired companies or legacy properties is having different IDs on different domains.
  • Form submissions vs. link clicks: GA4's automatic cross-domain linker only decorates <a> tag clicks by default. If users navigate between domains via form submissions, you may need custom JavaScript to append the _gl parameter to the form action URL.
  • iFrames: Cross-domain tracking through iFrames requires additional configuration and is generally more fragile. Consider whether the iframe content truly needs to be part of the same session.

When NOT to Use Cross-Domain Tracking

  • Subdomains: As mentioned above, subdomains of the same root domain share cookies automatically. Adding them to cross-domain configuration is unnecessary and can cause issues.
  • Different businesses: If two domains represent completely different businesses with separate user bases, tracking them as one property creates noisy, meaningless data. Use separate GA4 properties instead.
  • Third-party sites you don't control: If users navigate to a payment gateway or external service where you can't install your GA4 tag, cross-domain tracking won't work. Instead, add that domain to your unwanted referral list to prevent session fragmentation on return.

Verifying Your Implementation

How to Test That Cross-Domain Tracking Is Working

Use these methods to confirm the implementation is functioning correctly before relying on the data:

  1. Check the URL: Navigate from Domain A to Domain B and inspect the URL. You should see a _gl parameter appended. If it's missing, the linker configuration isn't working.
  2. Compare client IDs: Open Chrome DevTools on both domains and check the GA4 cookie (_ga) value. The client ID should be identical on both domains after cross-domain navigation.
  3. GA4 Realtime Report: Navigate between domains and check the Realtime report. You should see a single active user, not two.
  4. Check referral reports: In GA4, go to Traffic Acquisition and check if your own domains appear as referral sources. If they do, your unwanted referral list isn't configured correctly.
  5. GA4 DebugView: Enable debug mode on both domains and verify that the same client ID appears for events on both domains.

Automatic Detection

NiceLookingData detects self-referrals in your GA4 data, identifies missing unwanted referral exclusions, and flags cross-domain configuration gaps that cause session fragmentation. We also alert you to subdomains that have been unnecessarily added to cross-domain configuration.

Key Takeaways

  • Cross-domain tracking is only needed for different root domains, not subdomains — GA4 handles subdomains automatically.
  • Configure domains in GA4 Admin (Data Streams → Configure Tag Settings → Configure Your Domains).
  • Always update the unwanted referral list to prevent self-referrals from fragmenting your session data.
  • Test by checking the _gl parameter in URLs and comparing client IDs on both domains.
  • Form submissions and redirects can break the linker parameter chain — test the complete user journey, not just direct link clicks.

Frequently Asked Questions

What is cross-domain tracking in GA4?

Cross-domain tracking in GA4 is a configuration that allows a single user session to be maintained across two or more different domains. Without it, GA4 treats each domain as its own origin and starts a new session when a user crosses a domain boundary — fragmenting the user journey and misattributing conversions. GA4 achieves cross-domain stitching by appending a _gl URL parameter containing the client ID when a user navigates from one configured domain to another.

When do I need cross-domain tracking?

You need cross-domain tracking when users move between different root domains as part of a single conversion journey, both domains send data to the same GA4 property, and you need attribution and session data to reflect the full journey. The most common case is a marketing or content site on one domain with a checkout or SaaS product on another. If your user journey stays within a single root domain — even across multiple subdomains — cross-domain tracking is not necessary.

Does GA4 cross-domain tracking work automatically?

No. GA4 does not automatically stitch sessions across different domains. You must explicitly configure which domains participate in cross-domain tracking in the GA4 Admin interface (Admin → Data Streams → Configure Tag Settings → Configure Your Domains). Once configured, GA4 handles the _gl linker parameter decoration automatically for link clicks between those domains — but the initial admin configuration is a manual step that must be done for each GA4 property.

How do I know if cross-domain tracking is broken?

The most reliable indicator is seeing your own domains appear as referral sources in the GA4 Traffic Acquisition report. When cross-domain tracking is misconfigured or missing, GA4 treats the navigation from Domain A to Domain B as a new session originating from Domain A — which shows up as a referral. You can also check directly by navigating between your domains and inspecting the destination URL for the _gl parameter. If it's absent, the linker isn't firing. Comparing the _ga cookie values across both domains after navigation is the most definitive test.

Does cross-domain tracking work with Shopify checkout?

Cross-domain tracking with Shopify checkout depends on which checkout domain you're using. If your store uses Shopify's standard checkout on your-store.myshopify.com or a custom checkout subdomain like checkout.yourstore.com, you can configure cross-domain tracking by adding both your main store domain and the checkout domain to the GA4 domain list. However, Shopify's checkout is a closed environment — you need to install GA4 there either via Shopify's native Google & YouTube channel integration or via a checkout.liquid customization (Shopify Plus only). Without GA4 installed on the checkout domain, no stitching is possible regardless of how the domain list is configured. For non-Plus Shopify stores using hosted checkout, the Shopify GA4 integration handles thank-you page tracking separately via server-side events.

What is the difference between cross-domain and subdomain tracking?

Cross-domain tracking applies to sessions spanning different root domains (e.g., example.com and example.io). Subdomain tracking refers to sessions across subdomains of the same root domain (e.g., blog.example.com and shop.example.com). GA4 handles subdomain tracking automatically using first-party cookies scoped to the root domain (example.com), so no configuration is needed. Cross-domain tracking requires explicit configuration because cookies do not cross root domain boundaries by browser design. A frequent misconfiguration is adding subdomains to the cross-domain list — this is unnecessary and can introduce subtle bugs.

How do I configure GA4 cross-domain tracking in GTM?

The recommended approach is to configure cross-domain domains in the GA4 Admin interface (Admin → Data Streams → Configure Tag Settings → Configure Your Domains) rather than in GTM. Settings in GA4 Admin apply to all implementations of that Measurement ID regardless of whether they use GTM, gtag.js, or another method — so it's the single source of truth. If you prefer to configure it in GTM, open your GA4 Configuration tag, expand the advanced settings, and add your domains in the Cross Domain section. Whichever approach you use, also configure the unwanted referral list in GA4 Admin to prevent your own domains from appearing as referral sources.

How do I test that cross-domain tracking is working?

There are four practical tests. First, navigate from Domain A to Domain B and inspect the destination URL — a _gl parameter should appear in the URL bar. Second, compare the _ga cookie values on both domains using Chrome DevTools (Application → Cookies); the client ID embedded in the cookie should be identical after cross-domain navigation. Third, open the GA4 Realtime report while navigating between your domains — you should see one active user, not two. Fourth, check the Traffic Acquisition report after a few days and confirm your own domains no longer appear as referral sources. If all four pass, cross-domain tracking is configured correctly end to end.

Written by
Ludde Nyström — Founder, NiceLookingData

Analytics consultant turned founder. After years running the same GA4 and GTM audits across client engagements, Ludde built the audit into a product — so the pattern-matching takes a minute, not a meeting. More about Ludde →

Free tool

Run a free GA4 audit.

Connect your Google Analytics 4 property. Our auditor runs 61 checks and gives you an instant health score with a plain-English action plan.

Thanks for reading.