Google Analytics lets you track subdomains in multiple profiles or a single profile. This article describes how to set it up in a single profile.
If you follow the first steps in the article then visitors to the following pages
Show up in Google Analytics as
The important point here is you can't distinguish between visitors to identical pages. So in the above report, Google Analytics shows / which combines visitors to the home page of both subdomains. So the article goes on to provide steps for how to prefix the page names with the domain name to distinguish. If you follow those steps then the above pages would show up as
I implemented that, and it worked fine. But for me there were a couple of drawbacks.
- The filter only applies to new traffic, so your content pages no longer match your historical tracking, and you may have to update your goals or other custom reports
- Visits to www.budgetweb.com and budgetweb.com will result in separate page content showing up in the reports
The latter means that where previously requests to www.budgetweb.com and budgetweb.com would be combined in the content report, they now show up as separate requests. So visits to the home pages show up in the reports as
This particular issue can be addressed with a search and replace filter as follows
- Filter Type: Custom Filter / Search and Replace
- Filter Field: Hostname
- Search String: ^www\.budgetweb\.com
- Replace String: budgetweb.com
- Case Sensitive: No
Just remember to put this filter ahead of the one setup in the article mentioned above.
But there's another approach that addresses both of the issues above, at least for me. If you've got history on one domain, and you are interested in tracking a subdomain in that same google analytics web profile, then this should work for you too.
- Filter Type: Custom Filter / Advanced
- Field A->Extract A: Hostname / (blog).*
- Field B->Extract B: Request URI / (.*)
- Output To->Constructor: Request URI / /$A1$B1
- Field A Required: Yes
- Field B Required: No
- Override Output Field: Yes
- Case Sensitive: No
After implementing this approach, the 4 requests mentioned above show up in the content report as
This means that the requests for www.budgetweb.com continue to match the history, and no changes need to be made in any goals or custom reports. And the new content shows up with a convenient short directory prefixed to the content pages.