Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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:

  1. In the Profile Settings page, click the Add Filter link.
  2. Choose Add New Filter and provide the filter a name.
  3. Choose Custom Filter and select Advanced on the Filter type settings.
  4. Under Advanced settings: FieldA should be set to Hostname FieldB should be set to Request URI
  5. Set the values for both Field A and Field B to (.*), which is an expression that captures all characters.
  6. Set the Output To --> Constructor option to Request URI and provide $A1$B1 as the value for that choice.

Your reports will now show:

  • www.example.com/index.php
  • sub.example.com/more.php

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:

givensubdomain\.domain\.com

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.

share|improve this question

marked as duplicate by bybe, John Conde May 13 '13 at 11:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
That question is about cross-domain tracking. This one is not. –  Joudicek Jouda May 12 '13 at 22:28
    
webmasters.stackexchange.com/questions/18050/… covered in Jeff's answer I believe near the bottom. –  bybe May 13 '13 at 0:08