This question already has an answer here:
I would like to track a main domain in Google Analytics and also its multiple subdomains. But I would like each domain to have its profile, to be able to view every subdomain separately.
I made an account GA and its property. Then I made a profile for the main domain and created a rule to add domain name to the results:
- In the Profile Settings page, click the Add Filter link.
- Choose Add New Filter and provide the filter a name.
- Choose Custom Filter and select Advanced on the Filter type settings.
- Under Advanced settings: FieldA should be set to Hostname FieldB should be set to Request URI
- Set the values for both Field A and Field B to (.*), which is an expression that captures all characters.
- Set the Output To --> Constructor option to Request URI and provide $A1$B1 as the value for that choice.
Your reports will now show:
It's tracking code is:
_gaq.push(['_setAccount', 'UA-12345-1']); _gaq.push(['_setDomainName', 'domain.com']); _gaq.push(['_trackPageview']);
Then I created another profile for the subdomain, where I set the same tracking code and also the same website's URL (
http://www.domain.com) for every subdomain. Is this the right way to do so?
I also added a rule for all subdomains to include hostname:
Is it ok? I'm asking because I can see some online visitors in real time reports for both domains and subdomains, but I'm unable to see those when I look into the standart reports and set the date for today.