|Multipule trackers on one page||diyfwghk||9/7/11 7:19 PM|
I have a site that is based on master template, which the master template is maintained by another party.
I have added a Google Analytics tracker (with event tracking) in the site for a while.
Recently, the event tracking has stopped (pageview data is still tracked).
After researching, I found out that the master template has a GA tracker as well. Hence, the 2 trackers crashed and my tracker stopped receiving event data.
Both trackers is using asynchronous tracking. So, I am reading this page.
a) Both trackers is using asynchronous tracking.
b) I can only change my tracker. I have no control to the tracker on the master template.
c) My tracker (in <head>) is loaded earlier than master one (in <body> and using external js file).
d) My tracker tracks outbound link clicks. I bound jquery events in document.ready. Therefore, I think the event data goes to the master template tracker, which is loaded later than mine.
Here are my questions:
1. If I change my tracker code to below, it should work, right? My tracker is loaded earlier than the master one.
_gaq.push(['b._trackEvent',a,b,c]); /* a,b,c are some variables */
2. There are 2 GA tracker loading scripts, will they crash? Should I comment my tracker's loading scripts?
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script'); s.parentNode.insertBefore(ga, s);
Many thanks for everyone's help!
|Re: Multipule trackers on one page||iDpl||9/20/11 3:33 AM|
I've tried this solution with two analytics accounts.
Events for b._trackEvent does not appear in Google stats.
Still looking for solution to track events on second account.
|Re: Multipule trackers on one page||Prabhat.kumar||9/21/11 3:07 AM|
You only need to call this & no need to change master template code etc
|Re: Multipule trackers on one page||Eric Patterson||9/26/11 11:46 AM|
I have this up and working also. indiaseo is correct. Just push your new tracker name's ('b' in this example) functions into the gaq queue and it will work. No need for the extra loading script, or at least I do not have it in mine.
|Re: Multipule trackers on one page||diyfwghk||9/26/11 5:53 PM|
indiaseo's solution works!
Just to remind others, b is only an example. You can use other names.