I just created a 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 that I wanted to track, but I noticed that when the tracking code was generated, it referred to the main domain, not the subdomain that I entered. See below, and note that in the code below I replaced the actual domain "example.com". So, I have two questions related to this
I plan to insert this tracking code into my subdomain, but do I need to do something in the analytics settings to make sure that I see only statistics for my subdomain, and not the main domain? I have no control over the primary domain, and they do not have the analytics installed on it.
If the person in charge of the primary domain decides to install analytics on the primary site, will my code affect my account in any way that my tracking code refers to the primary 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>
subdomain analytics google-analytics
user3137996
source share