Mobile app version of vmapp.org
Login or Join
YK1175434

: Sub Domain Anaytics Tracking I have a WordPress multisite with two sites. One at the main domain, and one at a sub-domain. I have Google Analytics running on both sites, and it is turned

@YK1175434

Posted in: #GoogleAnalytics #Subdomain

I have a WordPress multisite with two sites. One at the main domain, and one at a sub-domain. I have Google Analytics running on both sites, and it is turned on to track sub-domains. See screenshot:



I have this piece of javascript on each site in header.php:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'my-UA-code']);
_gaq.push(['_setDomainName', 'andy-warren.net']);
_gaq.push(['_trackPageview']);

(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>


I'm getting data in Analytics, but I don't know how to differentiate between the domain and the sub-domain. Am I missing something in the settings or piece of tracking code? Or can I just somehow choose to see the domain or sub-domain in Analytics?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @YK1175434

2 Comments

Sorted by latest first Latest Oldest Best

 

@Angela700

If you would prefer to see both of the sub-domains listed in one profile, add a filter to the profile with both domains with:
Filter type:custom filter
Advanced:
Field A -> Extract A Hostname (.)
Field B -> Extract B Request URI (.)
Output To -> Constructor RequestURI $A1$B1
Field A Required
Field B not required
Override Output field yes
Case sensitive no.

Then you will see the full url of the page including the domain and subdomain when looking at content. It makes it easier for comparisons between pages this way. It will only make the change from the date you add in the filter though, so test this in a blank profile before you put it in your live one.

10% popularity Vote Up Vote Down


 

@Goswami781

You can create a profile to look specifically at both the subdomain and domain.

1) Go to Admin > View (Profile) and "Create new view" (under the dropdown).

2) Create a filter that includes only traffic from the hostname that are equal to andy-warren.net. This will be your andy-warren.net top-level domain profile.

3) Create a filter that includes only traffic from the hostname that are equal to subdomain.andy-warren.net. This will be your subdomain.andy-warren.net subdomain profile.

Third, you could have a profile (probably the profile your currently using) that contains no filters i.e. it's a rollup/global profile for all your websites.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme