Forum Moderators: DixonJones
I would like to track my domain.com and domain.com/directory with two separate Google analytic tracking code. I am about to implement the following code.
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-123456-1");
pageTracker._initData();
pageTracker._trackPageview();
var pageTracker2 = _gat._getTracker("UA-123456-2");
pageTracker2._initData();
pageTracker2._trackPageview();
</script>
>> Is it a right way to implement? If so, please advice where these code need to installed. Only in all pages in Sub directory / Domain + Sub Directory.
Greatly appreciate the help.
Thank you!
That way profile 1 has all page data, and profile 2 just the /directory data.
Actually I don't think you even need separate code for this. Can't you just setup a new profile in GA using a filter? It looks like you are using GA code from the same account... So you should just be able to setup a filter on /directory and it will have its own profile in GA.