Forum Moderators: DixonJones

Message Too Old, No Replies

Tracking Multiple Domains

Tracking Multiple Domains

         

Nups

9:57 am on Jul 3, 2008 (gmt 0)

10+ Year Member



Hi Guys,

I want to add GA tracking code across 2 domains. Here is how the visitors travel from domain abc.com to xyz.com

Step 1: abc.com/page1

Step 2: abc.com/page2

Step 3: xyz.com/page1

As per Google Analytics' Help Section, I am supposed to add the following code (with 2 extra lines) on all the pages of both the domains.

<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-#*$!xx-x");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._initData();
pageTracker._trackPageview();
</script>

It then instructs to add the _link function to any links between the domains AND instructs to add analytics tracking code and calls to _gat._getTracker and _initData on the page above the call to _link.

So I have placed the entire GA tracking code above the link pointing to xyz.com domain (see example below).

<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-#*$!xx-x");
pageTracker._setDomainName("none");
pageTracker._setAllowLinker(true);
pageTracker._initData();
pageTracker._trackPageview();
</script>
<a href="xyz.com/page1" onclick="pageTracker._link(this.href); return false;">

My question is - Is this right? OR do I need to add the complete tracking code again at the bottom of the page just before </body> tag.

Please give me your suggestions on how to get this done.

Aaron Kocourek

2:07 am on Jul 4, 2008 (gmt 0)

10+ Year Member



I am also having the same problem. I emailed Google and their solution did not work.

Any help would be appreciated!

- Aaron Kocourek