One of the most common questions during the migration from Universal Analytics (UA) to Google Analytics 4 (GA4) is: “How do I set up GA4 subdomain tracking?”
If you manage a digital ecosystem that includes blog.example.com, shop.example.com, and www.example.com, you are likely worried about broken sessions and inflated user counts.
The short answer is: Yes, GA4 tracks subdomains natively and automatically.
However, while the tracking is automatic, the reporting often hides this data by default. This guide will explain how GA4 handles subdomains, the one major mistake you must avoid, and how to configure your reports to see exactly which subdomain is driving traffic.
Does GA4 Track Subdomains Natively?
In the old days of Universal Analytics, developers often had to tinker with cookie configurations (cookie Domain: ‘auto’) to ensure a user was tracked as the same person when moving from your main site to your blog. GA4 has simplified this entirely.
How GA4 Handles Cookies
- Root Domain Cookies: GA4 automatically sets cookies at the highest level of your domain (e.g., .example.com).
- Session Continuity: Because the cookie is set at the root, the unique User ID persists across all subdomains.
- No Double Counting: If a user visits www.example.com and clicks a link to shop.example.com, GA4 recognizes this as one session from one user.
The Golden Rule: One Measurement ID
For this “magic” to work, you must use the same Data Stream (and therefore the same Measurement ID, usually starting with G-) on every subdomain.
Warning: If you create separate Data Streams or Properties for your subdomains, GA4 cannot stitch the user journey together. You will see self-referrals and broken sessions.
For more information on setting up properties correctly, refer to the official Google Analytics Help Center. or contact us to ensure your setup is flawless
Common Mistakes: Cross-Domain vs. Subdomain Tracking
There is a setting in the GA4 Admin console called Configure your domains (often referred to as Cross-Domain Tracking). Do not use this for subdomains.
- Subdomain Tracking (Automatic): Tracking users between blog.site.com and site.com. No configuration needed.
- Cross-Domain Tracking (Manual): Tracking users between site.com and totallydifferenturl.com. This requires configuration.
If you add your subdomains to the “Configure your domains” list, you add unnecessary complexity that can actually break your attribution.
Solving the Reporting Problem with Hostnames
While GA4 collects the data correctly, it doesn’t always show it clearly. By default, GA4 reports use the Page path dimension (e.g., /contact-us).
If you have a /contact-us page on both your main site and your help desk subdomain, GA4 will lump them together in the report. You won’t know which is which unless you utilize the Hostname dimension.
Step-by-Step Setup Instructions
Here is how to ensure your tracking is active and how to modify your reports to distinguish between your subdomains.
Phase 1: Installation & Validation
- Open GA4 Admin: Go to your Property settings.
- Get Measurement ID: Navigate to Data Collection and modification > Data Streams. Click your web stream and copy the Measurement ID (e.g., G-12345ABC).
- Install Code: Paste this exact same tag snippet (or GTM Configuration Tag) on every subdomain you want to track (www, blog, shop, support).
- Verify: Use the “DebugView” in GA4. Navigate between your subdomains. If the timeline shows a continuous stream of events without the user dropping off, it is working.
Phase 2: Updating Standard Reports
Since GA4 aggregates data, let’s add a column to your reports so you can see which subdomain the traffic belongs to.
- Navigate to Reports > Engagement > Pages and screens.
- Look for the Pencil Icon (Customize report) in the top right corner.
- Click on Dimensions in the right-hand sidebar.
- Click Add Dimension and search for “Hostname”.
- Click the three dots next to Hostname and select “Set as Default”.
- Click Apply and then Save.
Now, your Pages report will show columns for both the page path and the hostname (e.g., blog.example.com), allowing you to filter and segment your data accurately.
Conclusion
GA4 subdomain tracking has made data collection significantly easier than its predecessor. As long as you keep the tag consistent and avoid unnecessary “cross-domain” settings, your data will flow seamlessly. The real trick lies in mastering the Hostname dimension to make sense of that data in your reports. If you need assistance configuring your custom reports, RevKeter can help.

