Welcome to WebmasterWorld Guest from 54.146.248.111

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

Multiple Tracking codes

     

intruder2000

11:39 am on Nov 7, 2008 (gmt 0)

5+ Year Member



I hould like to install multiple Google tracking codes ( the uacct = "UA-#*$!#*$!-X";) on a single page. The purpose behind this is that on this specific page, there are multiple vendors who supply content and need to track usage.

I added two UA tags but Google only provided tracking information to the second UA tag.

Does anyone know if it is possible to have two or more Google UA tags on the same page?

I've got the same problem. Does anybody know if it's possible?

mark_roach

12:45 pm on Nov 7, 2008 (gmt 0)

10+ Year Member



Yes you can track a single page in multiple accounts. The following code should do the trick:


<script type="text/javascript">
var firstTracker = _gat._getTracker("UA-YYYYYYY-1");
firstTracker._initData();
firstTracker._trackPageview();


var secondTracker = _gat._getTracker("UA-ZZZZZZZ-1");
secondTracker._initData();
secondTracker._trackPageview();
</script>

intruder2000

1:20 pm on Nov 7, 2008 (gmt 0)

5+ Year Member



Hi Mark,

Thanks for your post!

In the Website I want to track I have the following code:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
_uacct = "UA-YYYYYYY-3";
_uacct = "UA-ZZZZZZZ-1";
urchinTracker();
</script>

</body>
</html>

I will substitute your code for my 6 current code lines above. Is that all I need to do?
I can't test it right now because I don't have FTP access with me.

Tanks a lot!

mark_roach

1:57 pm on Nov 7, 2008 (gmt 0)

10+ Year Member



The code I posted is for the most recent version of the analytics code. You are currently using the older version. If you are not doing any fancy tracking is is very straightforward to migrate to the newer version

Adding the new tracking code [google.com]

There is a migration guide [google.com] on the analytics site, for converting more complicated tracking.

In the migration guide it shows an example of multiple tracking for the older version:


<script type="text/javascript">
_uacct = "UA-#*$!XX-X";
urchinTracker();
_uff = 0; // Reset flag to allow for second account
_uacct = "UA-#*$!XX-X";
</script>

I have never used the older version but I think there might be a typo. If the above code doesn't work I would try:


<script type="text/javascript">
_uacct = "UA-YYYYY-Y;
urchinTracker();
_uff = 0; // Reset flag to allow for second account
_uacct = "UA-ZZZZZ-Z;
urchinTracker();
</script>

Welcome to Webmasterworld BTW.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month