views:

363

answers:

2

I have one Google Analytics tracker (pageTracker) installed across my website. I want to install a second Google Analytics tracker (pageTracker2) so I can send data into another account. To test all this, I installed pageTracker2 only on one page: my splash page.

When I go into Google Analytics and look at the data for this splash page in Account 1, the time on page is reasonable (~2 min) but the bounce rate is very high; 99.54% compared to 30% before I installed pageTracker2).

In Account 2, same thing. The time on page is reasonable (~2 min) but the bounce rate is very high; 99.98%. For Account 2, I'm guess the bounce rate is inaccurate because I haven't installed pageTracker2 across my website, so this makes sense.

The problem lies with Account 1. Why does the bounce rate rise to ~99% when I install the second page tracker (pageTracker2)? The code for the splash page follows:

<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-ACCOUNT-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>    
<script type="text/javascript">
try{
var pageTracker2 = _gat._getTracker("UA-ACCOUNT-2");
pageTracker2._setDomainName(".mydomain.com");
pageTracker2._trackPageview();
} catch(err) {}
</script>
+4  A: 

Google tells you not to install two trackers in the same page, as it could cause inconsistencies... There you have them!

Also, this thread might help you: http://www.google.com/support/forum/p/Google+Analytics/thread?tid=4731d8a407382376&amp;hl=en

Seb
Rahil Sondhi
Yeah, that's right. But installing two trackers should be done *only* in very rare occasions. And if you *really* need it, you must know it's not achieved by simply copy-pasting the default analytics code. As most rare requirements do, it needs tweaking.
Seb
The scenario that is posed by the google analytics blog you linked to is a case where you would need two trackers (they have multiple domains that need to be tracked individually and as a group). So it is recommended because the situation calls for it. In your case do you have two domains that need to be tracked as one? It seems you just want the data to be present under two accounts, which to me is not a situation that can be considered "recommended". Anyway, you can try making your tracker code identical to the google analytics blog - changing the domain of course and see if that helps.
Waleed Al-Balooshi
A: 

Try this instead:

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")); try{ var pageTracker = _gat._getTracker("UA-ACCOUNT-1"); pageTracker._trackPageview(); var pageTracker2 = _gat._getTracker("UA-ACCOUNT-2"); pageTracker2._setDomainName(".mydomain.com"); pageTracker2._trackPageview(); } catch(err) {}
Affan Laghari