2

I set up a subdomain and Google Analytics is showing traffic for the subdomain.

However, going into Content section, GA is not showing pageviews of the pages of the subdomain. Instead, GA lumps all the pageviews in the subdomain.

I checked the code of subdomain pages, and they're all the same as the subdomain homepage.

Here is my tracking code:

<script type='text/javascript'>try {
 var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-xxxxxxx-85']);
 _gaq.push(['_setDomainName', 'domain.org']); 
 _gaq.push(['_setAllowAnchor', true]); 
 _gaq.push(['_trackPageview', '/?scid=a2412a40-1b66-4e0a-a1d5-f5b260de6ee8']);
 _gaq.push(['b._setAccount', 'UA-xxxxxxx-56']);
 _gaq.push(['b._setDomainName', 'domain.org']);
 _gaq.push(['b._trackPageview']);
 } catch (err) {}
 (function() {
 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 })();
 </script>

Am I missing a dot somewhere?

1 Answer 1

2

GA is not showing pageviews of the pages of the subdomain. Instead, GA lumps all the pageviews in the subdomain.

This is because Google categorizes subdomains as internal links to the root domain, as covered here, and by default does not show the domain or subdomain in reports.

To solve this using one profile, create a filter as covered here:

  1. Under Admin -> View (Profile) -> View Settings, click Filters.

  2. Click + New Filter and provide the Filter Name.

  3. Under Filter Type chose Custom and select Advanced.

  4. Under Advanced:

    a. FieldA should be set to Hostname
    b. 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.

enter image description here

Alternatively, you can add another profile to Google Analytics for the subdomain, and create a filter to show only traffic for the subdomain:

Admin -> View -> Filters -> New Filter

enter image description here

Am I missing a dot somewhere?

In the past, it was suggested by Google to use a dot before the domain when including subdomains (i.e., .domain.org), however this is no longer advised as can be seen here (under Traditional (ga.js) syntax), since the dot causes cookie resets, as covered here (under number 2).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.