Ok what this tutorial will show you is how to set up 2 google analytics trackers on one site.. this is good if you have sub owners of your sites..
For litewarez theres me and the other admin where we have our own tracking settings.
The first thing you need to make sure is that you have jQuery included in your pages!
And heres is the function
Now as you can see the above code should be tracking out bound links and working with 2 seperate accounts!
Hope you enjoy
For litewarez theres me and the other admin where we have our own tracking settings.
The first thing you need to make sure is that you have jQuery included in your pages!
And heres is the function
Code:
GATracker = {
Start : function(){
this.LoadGoogle();
},
LoadGoogle : function(){
var http_ = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.")
$.getScript(http_ + "google-analytics.com/ga.js",function(){
/*Here the main js source for google is loaded we can start for each account*/
var admin_one = _gat._getTracker("UA-XXXXXXXX-X");
var admin_two = _gat._getTracker("UA-XXXXXXXX-X");
/*Ok so now we have to varaibles that you can do some stuff with...*/
/*Both trackers are running now and google should recived data*/
/*
This is a little nifty trick you can do to percifically
track outbound links, katz do this aswell. but you dont have to
*/
$('a[href^=http]:not("[href*=://' + document.domain + ']")').click(function() {
admin_one ._trackPageview('/external/' + $(this).attr("href"));
admin_two ._trackPageview('/external/' + $(this).attr("href"));
}
});
}
}
/*And anywhere in your javascript you can load the tracker like so*/
$(document).ready(function(){GATracker.Start();});
Now as you can see the above code should be tracking out bound links and working with 2 seperate accounts!
Hope you enjoy