Google Analytics on Subdomain

I just generated the tracking code for a new Google Analytics account, and the domain I want to track is actually a subdomain. When setting up the account, I entered the subdomain as the URL I wanted to track, but I noticed when the tracking code was generated, it referenced the main domain and not the subdomain I had entered. Please see below, and please note that in the code below, I replaced the actual domain with "example.com". So, I have two questions related to this

  1. I plan to insert this tracking code on my subdomain, but do I need to do anything special in the analytics settings to ensure that I only see stats for my subdomain and not the main domain? I don't have control over the main domain, and they don't have analytics installed on it.

  2. If the person in charge of the main domain decides to install analytics on the main site, will my code affect his account in any way being that my tracking code references the main domain instead of my subdomain?

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-46251874-1', 'example.com');
ga('send', 'pageview');
</script>

Answers


According to Google's analytics help, specifying the root domain in the way you have will allow you to track stats on subdomains. So no, it doesn't seem like you need to do anything special.

https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#domainSubDomains


Need Your Help

Android fails to inflate layout

android android-layout bitmap out-of-memory android-imageview

I'm working on a project and a section of it that has been working for weeks all of a sudden throws the following error

OpenCV 2.4.7 conflict with Qt 4.8.1 QImage

c++ qt opencv qimage

Ubuntu 12.04, Qt 4.8, OpenCv 2.4.3, PCL 1.6. Developing all via Qt Creator 2.5.2. All in 64 bits version.