Cross-Domain Tracking Configuration in Google Analytics
AI-Generated Content
Cross-Domain Tracking Configuration in Google Analytics
Imagine a customer starting their journey on your main marketing site, clicking a link to read a blog post on a separate domain, and finally converting on a dedicated e-commerce checkout domain. Without the proper configuration, Google Analytics would treat this single user as three separate, anonymous visitors, shattering your understanding of the customer journey. Cross-domain tracking is the technical solution that stitches these fragmented sessions together, ensuring you see the complete path to conversion across all your owned digital properties.
Understanding the Cross-Domain Problem and Core Mechanism
By default, Google Analytics 4 (GA4) identifies and tracks users using a combination of cookies and a unique client ID. When a user clicks a link to move from yourstore.com to checkout.yourbrand.net, the browser treats this as a new website visit. The _ga measurement cookie, which stores the client ID, is not shared between these different domains for security and privacy reasons. Consequently, GA4 generates a new client ID for the user on the second domain, starting a fresh session and losing all connection to their previous activity.
The core mechanism that solves this is the automatic passing of the client ID via URL parameters. When cross-domain tracking is correctly configured, links between your listed domains are rewritten on the fly. A click from Site A to Site B appends a _gl parameter (e.g., ?\_gl=1*abc123...) to the URL. When the Google tag on Site B loads, it detects this parameter, extracts the original client ID from it, and continues the existing session rather than beginning a new one. This process is seamless to the user but critical for your data integrity.
Step-by-Step Configuration in Google Analytics 4
Configuration happens centrally within your GA4 data stream settings. Navigate to Admin > Data Streams, select your web stream, and then configure your Tag Settings. Under the "Configure your domains" section, you will find "Configure your domains" for cross-domain tracking.
- List Your Linked Domains: In the interface, you add all domains involved in the user journey. For our example, you would add both
yourstore.comandcheckout.yourbrand.net. You must list every domain where you want sessions to be linked. Crucially, you must also list subdomains (likeblog.yourstore.com) if you wish to track across them, as GA4 treats subdomains as separate domains by default in this context. - Implement the Updated Tag: After saving the configuration in the GA4 interface, you must update your Google tag on every page of every domain you listed. The configuration settings are bundled into the tag code itself. Simply copy the modified tag from the "Installation Instructions" panel in your data stream and replace your existing tag on all sites. This ensures every site can both send and recognize the cross-domain linker parameter.
Configuring Critical Referral Exclusions
Even with cross-domain linking configured, a user might arrive at your second domain without the linker parameter—for instance, if they type the URL directly or follow a bookmarked link. In such cases, GA4 would see the traffic originating from your own first domain as a referral, which would prematurely end the original session.
To prevent this, you must add all your own domains to the Referral Exclusion List. This is found in Admin > Data Streams > [Your Stream] > "More Tagging Settings". Adding yourstore.com here tells GA4, "Do not start a new session when traffic comes from this source; allow it to continue the existing session if possible." Neglecting this step is a common reason cross-domain tracking appears to fail, as your own sites can inadvertently become external referrers in your reports.
Verification and Testing Your Setup
Configuration is not complete without rigorous testing. GA4 provides tools to verify the setup is working.
- Real-Time Report Verification: Open the Realtime report in GA4. On your primary domain, generate a page_view event—you should see yourself appear. Now, click a configured link to your secondary domain. Crucially, do not use the browser's address bar; you must follow a link that the Google tag can rewrite. In the Realtime report, you should see the event stream continue under the same user count. The "Page title and screen name" card should update to show activity on the new domain, all within the same active user session.
- DebugView and User Flow Testing: For a technical deep-dive, use GA4's DebugView. With debug mode enabled in your browser, perform a cross-domain journey. In DebugView, you should see all events—from both domains—stream in a single, continuous timeline under the same debug device ID. This is the most definitive proof that the client ID is being preserved. Furthermore, you can test the actual user flow by navigating across domains and then checking the
_glparameter in the destination URL's address bar, confirming the linker is active.
Common Pitfalls
- Forgetting Self-Referral Exclusions: As outlined, failing to add your own domains to the referral exclusion list will break session continuity. This often manifests in your Acquisition reports where your main site appears as a referring source to your checkout site, splitting the user journey.
- Incomplete Tag Deployment: The updated Google tag with the cross-domain configuration must be deployed on every single page of all linked domains. If your blog domain still has the old tag, it cannot recognize the incoming linker parameter, causing a new session to start.
- Misusing URL Builders for Internal Links: Manually adding UTM parameters (like
utm_source) to links between your own domains is a dangerous practice. These campaign parameters will override the natural session data and can cause a new session to start, defeating the purpose of cross-domain tracking. Let the automatic linker parameter (_gl) do its work without interference. - Assuming Subdomains are Automatic: A site on
shop.example.comand another onhelp.example.comare considered different domains for cross-domain tracking purposes. You must explicitly list both in the "Configure your domains" section if users navigate between them and you need a unified session.
Summary
- Cross-domain tracking is essential for accurately measuring user journeys that span multiple separate website domains or subdomains, preventing a single user from being counted as multiple, disconnected visitors.
- Configuration is managed in the GA4 interface under your web data stream's "Configure your domains" settings, but requires updating and deploying the modified Google tag on every page of all linked sites to function.
- The Referral Exclusion List must include your own domains to prevent them from accidentally triggering new sessions as external referrers.
- Verification is a mandatory final step, best done using GA4's Realtime reports and DebugView to confirm that the client ID and session persist as a user navigates from one domain to the next.
- Avoid using manual campaign parameters on internal cross-domain links, and remember to explicitly list all subdomains in your configuration to ensure complete coverage.