Google Analytics 4: How to Track Users Seamlessly Across Domains and Subdomains

For businesses and marketers seeking to comprehend the entire customer journey across websites, Google Analytics 4 (GA4) offers powerful capabilities—if implemented effectively. Unlike its predecessor, Universal Analytics (UA), GA4 rethinks how sessions and users are tracked, which means that configurations you previously took for granted may now require explicit setup.
A key example is tracking users across multiple domains or subdomains. Without proper configuration, your data may show inflated session counts, misleading user metrics, or erroneous bounce rates—all of which can undermine marketing attribution and site optimization.
Let’s walk through how to ensure your GA4 setup captures cross-site behavior accurately and how it differs from Universal Analytics.
Tracking Across Different Domains: Explicit Cross-Domain Configuration Required
In Universal Analytics, cross-domain tracking was possible but often relied on customization of the ga.js
or analytics.js
libraries, and implementing it required both tagging expertise and cookie management finesse. GA4 simplifies much of this process, but it still requires intentional configuration.
Here’s how GA4 handles it:
- Same GA4 Property Across All Domains: All sites involved must implement the same Google Analytics 4 Measurement ID. This ensures all activity flows into a single property where user and session continuity can be preserved.
- Define the Domains in the Admin Interface: GA4’s Admin section now offers an interface for defining which domains are part of the same user journey. This is found under:
- Admin → Data Streams → [Your Web Stream] → Configure Tag Settings → Configure Your Domains.
- Session Preservation via URL Parameter: When configured, GA4 appends a special
_gl
parameter to links or form submissions that move users between your defined domains. This parameter transfers session and user metadata, allowing the destination site to recognize the source session and maintain continuity.
Without this, GA4 treats the arrival on the second domain as a new session by a new user, skewing metrics and severing the true user journey. Key Differences from UA:
- In UA, session stitching was often handled by manual customization.
- In GA4, it’s handled through automated tagging and the
_gl
parameter, but only if domains are explicitly configured. - GA4 also removes reliance on third-party cookies, making its domain-to-domain tracking more privacy-friendly but also more reliant on proper setup.
Tracking Across Subdomains: Automatically Handled by GA4
If you’re dealing with subdomains (e.g., shop.example.com
, blog.example.com
. The good news is that GA4 handles this automatically, as long as you’re using the same GA4 property across all of them.
This automatic handling works because GA4’s cookies are set on the root domain (e.g., .example.com
). This makes them accessible to all subdomains, allowing the same user and session to be recognized regardless of which subdomain they visit.
However, this assumes:
- You are using the same
G-
Measurement ID across all subdomains. - You have not manually restricted the cookie domain or scoped it incorrectly during advanced tag implementations.
If you ever need to analyze data separately for each subdomain, use the “Hostname” dimension in GA4 reports to filter or segment users based on the subdomain they visited.
Key Differences from UA:
- In UA, subdomain tracking often requires additional referral exclusions or hostname filters to prevent self-referrals.
- GA4 no longer suffers from these same limitations, making subdomain tracking more reliable out of the box.
Considerations and Caveats
While GA4’s handling of subdomains is mainly hands-off, cross-domain tracking demands precise implementation. And even with both:
- Session Integrity Depends on Navigation Type: If users move between domains using non-standard navigation (e.g., JavaScript-based button clicks or SPA transitions), the
_gl
parameter might not be passed unless explicitly handled. - Redirects May Break Tracking: If you’re using redirects (especially server-side or via meta refresh), ensure they preserve the URL query string—otherwise, the
_gl
parameter may be stripped. - Test Using DebugView: GA4’s DebugView is an invaluable tool for monitoring real-time data and ensuring session continuity during implementation testing.
Final Thoughts for Marketers
GA4’s cross-domain and subdomain tracking is a crucial upgrade for businesses managing multiple web properties. But unlike Universal Analytics, where some behaviors could be inferred or patched with workarounds, GA4 requires a deliberate and declarative setup to unify user sessions across properties.
Marketers who fail to implement cross-domain tracking will see inflated user counts, broken attribution paths, and misaligned performance data—errors that can undermine campaign success and mislead strategy.
By following GA4’s best practices for cross-property tracking and leveraging the “Hostname” dimension for subdomain reporting, businesses can ensure they’re capturing a true picture of user behavior—accurate, continuous, and actionable.