: Differentiating home root paths for domain and subdomain I have a web structure with a domain and a subdomain, let's call it example.com and blog.example.com. I want to be able to track both
I have a web structure with a domain and a subdomain, let's call it example.com and blog.example.com.
I want to be able to track both the main domain and it's subdirectory within the same Analytics profile so I've entered the same tracking code across example.com and blog.example.com
Tracking Codes:
This is the tracking code for the domain:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-1']);
_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>
And here is the code for the subdomain:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-1']);
_gaq.push(['_setDomainName','example.com'],['_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);
})();
Issue
Notice I've used _gaq.push(['_setDomainName','example.com'],['_trackPageview']); for subdomain tracking.
I see the post pages from the blog in the Analytics reports, but I can't distinguish between the homepage of the site and the homepage of the blog, they both appear in the reports in the same way (a slash /)
Question
Can anyone give me some insight on how to differentiate the homepage of the domain from the homepage of the subdirectory in GA reports?
More posts by @Carla537
1 Comments
Sorted by latest first Latest Oldest Best
To see the domain name along with the request path in the reports, create an advanced filter for your profile with the following settings:
Filter Type: Custom filter > Advanced
Field A: Hostname
Extract A: (.*)
Field B: Request URI
Extract B: (.*)
Output To: Request URI
Constructor: $A1$B1
You can also create a profile for each subdomain. For example for site1.com:
New profile named site1.com
In the new profile create a filter Include site1.com traffic only
Filter type set as Custom filter and Include
Filter field as Hostname
Filter pattern as ^site1.com$
Repeat for each domain. Data will only be collected once the profile is created.
(Google's explanation)
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.