In our user forums, we often get asked about ways to handle subdomain tracking in Google Analytics. Subdomain tracking is needed whenever you want to track multiple domains like this:
- www.example.com
- blog.example.com
- cats.example.com
in the same Google Analytics profile.
Subdomain Tracking Video
Steps:
- Install GA code. Default UA code, all subdomains.
- Create views, filters and exclusions.
- Test
- Run a celebration lap!
Notes:
When setting up the ‘Show subdomain filter’, here’s what you need:
Filter Type: Custom, Advanced
Field A -> Extract A
HOSTNAME —-> (.*)
Field B -> Extract B:
REQUEST URI —-> (.*)
Output To -> Constructor
REQUEST URI —-> $A1$B1
Click SAVE.
Lastly, test using Google Analytics Real Time reports which browsing the site in another window to see the hostname populate.
Brilliant – you made this so easy thanks 🙂
Thanks for the great info. I was just implementing and noticed that you might want to include “Hostname” and “Request URI” in your explanation of filters above.
Cheers,
//Dave
Hello Dave,
What if I wanted to leave out the “example.com” and instead just have
/
blog.
cats.
Is this possible in the above example or do I have to search and replace after implementing the above?