A Smart-Lazy Approach to Tracking Subdomains in Google Analytics
In our experience with managing projects for our clients, we’ve only known a few people who truly enjoy doing tracking setup. That’s because it’s not as “sexy” as A/B testing or as rewarding as ranking on the first page of Google’s search results.
Then again, it is inevitable. Prior to launching a campaign, making sure that the website tracking is set up correctly is imperative. Lucky for us, there are many ways to make tracking tasks more “appealing,” enough for your team to love it, as we do.
In true Hackalogy fashion, our objective is not just to teach people how to track their website but actually enjoy doing it.
So in this blog, we will teach you how to track subdomains in Google Analytics in the most efficient way possible.
But first off, what is Subdomain Tracking?
Using the NEO360 website as an example, let us explain what subdomain tracking is and how it can mess up your current Google Analytics setup if done the wrong way.
NEO360 is Hackalogy’s digital marketing agency arm. The websites are hosted in two different CMS. The non-blog content is hosted in WordPress, while all blog content is added in HubSpot.
https://neo360.digital/ – Main domain (hosted in WordPress)
https://blog.neo360.digital/ – Subdomain (hosted in HubSpot)
How Can Multiple Subdomains Mess Up Your Analytics?
Google Analytics 3 or Universal Analytics considers a domain a separate entity from a sub-domain. A visitor that moves from a domain to a subdomain will be:
- counted twice and;
- identified as referral sites
It will lead to more complications if the visitor goes back from the subdomain to the main domain.
Consider the following scenario:
Scenarios |
Visitor Count |
Visit Count |
Referring Site |
---|---|---|---|
Visitor arrives at neo360.digital from Google |
1 |
1 |
google.com |
Visitor clicks a link to go to blog.neo360.digital |
2 |
2 |
neo360.digital |
Visitor goes back to neo360.digital to send enquiry using the contact us page. |
2 |
2 |
blog.neo360.digital |
Total Calculated |
2 |
2 |
google.com neo360.digital blog.neo360.digital* |
Total Actual No. of Visitor and Visits |
1 |
1 |
google.com |
Note: * GA3 will keep track of all the referrals used in a session (through multiple trips in and out of the site, all within 30 minutes of the next), but it will only attribute the visit to the first one in the session.
The Fix: Setting up Google Analytics 4 (GA4) — seriously!
If you have multiple subdomains and have difficulty tracking them correctly, by migrating your current analytics setup to Google Analytics 4 (GA4), your subdomain tracking problem will be solved immediately.
Let’s go back to the NEO360 website example. We added GA4 tags in both the main and subdomain website.
Main Domain:
Subdomain:
We performed the test using Google Analytics 4 Debug View and below are the results:
Page Location = https://neo360.digital/ (Main Domain)
Page Location = https://blog.neo360.digital/neo360-new-office-announcement (Sudomain)
Based on our test, GA4 is recording one session ID from the same visitor visiting both main domain and subdomain URLs. A session ID is a unique number that a Web site’s server assigns a specific user for the duration of that user’s visit (session).
It simply means that a visitor that moves from a domain to a subdomain will only be counted once in your analytics.
In addition, the domain will not be identified as a referral. Thus, solving the issue of subdomain tracking.
To learn more about setting up Google Analytics 4 correctly, please subscribe to our newsletter to get Early Access to our Exclusive Google Analytics 4 content (Cheatsheets, Mini-Guides and Videos!).