I have 10 top-level domains e.g. example1.com, example2.com, example3.com, etc, and each domain has its own, unique website (not redirects). My goal is to have one Google Analytics account and one web property for all 10 websites, a master profile (the default) that shows me metrics of all websites combined, and 10 individual profiles for each website to limit the view to just that website... as if it had its own Google Analytics account. After much research and reading, I think I determined that all I would need to do is add the following code to each website:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX']);
_gaq.push(['_setDomainName', 'example1.com']);
_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>
Where the only thing that would change on each website would be the _setDomainName
to match whatever the website's address is e.g. example2.com, example3.com, etc.
Also, one website is actually at a sub-domain of a top-level domain (anothersite.example4.com), so I'm guessing I'd put exactly that in the _setDomainName
variable in that instance (regardless of whether it's a top-level domain or sub-domain.
Can someone confirm that I interpreted this correctly? Am I missing anything and is this a good way to set that up if I own all 10 web properties and want to later create an account for each website administrator to view metrics for their website only?