Cross-domain tracking in GA4 (finally made simple)
Learn how to configure cross-domain tracking in Google Analytics 4. Track users across multiple domains as single sessions with proper attribution.
If your users move between different domains (main site to checkout, blog subdomain to main site, or between regional domains), cross-domain tracking keeps them as one continuous session instead of separate visitors.
The good news: GA4 made this way easier than Universal Analytics.
When you need cross-domain tracking
| Scenario | Example | Need cross-domain? |
|---|---|---|
| Different root domains | site.com → checkout.com | Yes |
| Subdomains | blog.site.com → shop.site.com | Usually no (automatic) |
| Third-party checkout | site.com → shopify.com/checkout | Yes |
| Regional domains | site.co.uk → site.de | Yes |
| Separate app domains | site.com → app.site.io | Yes |
Note: Same-domain subdomains (blog.site.com, shop.site.com) are tracked automatically in GA4. You don't need cross-domain setup unless cookies are blocked between subdomains.
How it works
When a user clicks from Domain A to Domain B, GA4:
- Adds a
_glparameter to the destination URL - This parameter contains a linker value with session info
- Domain B reads the parameter and continues the same session
The URL looks like:
https://domainB.com/page?_gl=1*abc123*_ga*MTIzNDU...
Prerequisites
Before setting up:
- Same GA4 property for all domains
- Same Measurement ID on all domains
- GA4 code installed on all domains (same implementation method)
If different domains use different GA4 properties, cross-domain tracking won't work. All domains must feed into one property.
Setup method 1: GA4 interface (easiest)
This is the recommended approach for most setups.
Step-by-step
-
Go to Admin → Data Streams
-
Select your web stream
-
Click Configure tag settings
-
Click Configure your domains
-
Add all your domains:
Match type Domain Contains domainA.com Contains domainB.com Contains domainC.com -
Click Save
That's it. GA4 automatically:
- Adds linker parameters when users navigate between these domains
- Reads linker parameters on incoming traffic
- Excludes these domains from referral attribution
Match types explained
| Type | Example | Matches |
|---|---|---|
| Starts with | example | example.com, example.co.uk |
| Contains | example | example.com, my-example.org |
| Exactly matches | example.com | Only example.com |
| Matches RegEx | example.(com|net) | example.com, example.net |
For most cases, "Contains" works well.
Setup method 2: Google Tag Manager
If you need more control or are using GTM.
Step-by-step
-
In GTM, open your Google Tag
-
Expand Configuration Settings
-
Add or modify the
linkerparameter:Parameter Value linker {"domains":["domainA.com","domainB.com"],"accept_incoming":true} -
Save and publish
Or add individual settings:
| Parameter | Value |
|---|---|
| linker.domains | ["domainA.com","domainB.com"] |
| linker.accept_incoming | true |
Testing your setup
Quick test
- Go to Domain A
- Click a link to Domain B
- Check the URL: does it include
?_gl=parameter?
If yes, the linker is working.
Detailed test in DebugView
- Enable debug mode
- Navigate from Domain A to Domain B
- Check DebugView in GA4
- Both page views should show the same Client ID
Check Realtime
- Open GA4 Realtime report
- Navigate between domains
- You should appear as one user (not multiple)
Common issues and fixes
_gl parameter not appearing
Possible causes:
- Domain not in the list
- Link is JavaScript-based (not standard
<a>tag) - Redirect stripping parameters
Fix:
- Verify domain is added correctly
- For JS links, manually decorate URLs
- Work with developers to preserve parameters in redirects
_gl parameter gets stripped
Server redirects often remove URL parameters.
Fix:
- Configure redirects to preserve query parameters
- Use the Chrome extension "Redirect Path" to debug
- Check with your hosting provider or developers
Still seeing self-referrals
If Domain B shows as a referral source for Domain A:
- Check that cross-domain is configured correctly
- The
_glparameter must be present when crossing - GA4 should auto-exclude configured domains from referrals
Form submissions break tracking
Standard forms often don't carry the linker parameter.
Fix via GTM:
// Add to form's submit action
var form = document.getElementById('myForm');
form.action = form.action + (form.action.includes('?') ? '&' : '?') +
document.location.search.substring(1);
Or use GTM's form submit trigger with linker decoration.
JavaScript navigation
Single-page apps or JS-based navigation may not trigger automatic linking.
Fix:
// Manual linker decoration
gtag('get', 'G-XXXXXXX', 'linker_param', function(param) {
var url = 'https://domainB.com/page?' + param;
window.location.href = url;
});
Consent considerations
If users haven't consented on Domain A, they likely haven't on Domain B either. Cross-domain tracking can carry consent state if your CMP supports it.
Check if your Consent Management Platform can:
- Share consent across domains
- Preserve consent state in the linker parameter
Otherwise, users may need to consent again on each domain.
Verifying in reports
After a few hours of traffic:
- Go to Reports → Acquisition → Traffic acquisition
- Filter by source/medium
- Check if your other domains appear as referrals
- They should NOT appear if cross-domain is working
Check session counts:
- Compare sessions before and after enabling
- Sessions should decrease (fewer artificial "new" sessions)
- Average session duration may increase
Advanced: Multiple properties scenario
What if you want some domains in one property, others in another?
Short answer: You can't cross-domain track across different properties.
Workaround:
- Use one property for all domains
- Use segments or filters to separate analysis
- Consider GA4 360 sub-properties if needed
Enterprise considerations
For large organizations with many domains:
| Challenge | Solution |
|---|---|
| Many domains | Use regex matching in configuration |
| Different teams | Standardize on one GA4 property |
| Regional domains | Include all in cross-domain config |
| Headless CMS/SPAs | Manual linker decoration |
Next steps
Once cross-domain tracking works:
- Set up key events that span domains
- Build dashboards showing full journey
- Review attribution settings for multi-domain paths
Need a clearer view of your cross-domain analytics? Try Analayer. We help you understand complex user journeys across properties.
See your analytics clearly
Stop struggling with Google Analytics. Connect your account and get a cleaner, simpler view of your data in seconds.