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:
in the same Google Analytics profile.
Subdomain Tracking Video
- Install GA code. Default UA code, all subdomains.
- Create views, filters and exclusions.
- Run a celebration lap!
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
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.
What if I wanted to leave out the “example.com” and instead just have
Is this possible in the above example or do I have to search and replace after implementing the above?