S.a. arkadaşlar. Yabancı bir forumda gördüm, paylaşayım dedim. Yapacağımız işlem aynı site üzerinde birden çok analytics hesabını kullanmaya yarıyor. Ortaklıkla işletilen web sitelerinde işe yarayabilir. Yani istatistikleri hem siz, hem de ortağınız aynı anda izleyebiliyorsunuz. Kod aşağıda:
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();});
ÖNEMLİ: Kodu kullanabilmek için sayfalarınıza jQuery include edilmiş olmalıdır.
Bu kısımları kendi kodunuzla değiştirin:
Code:
var admin_one = _gat._getTracker(“UA-XXXXXXXX-X”);
var admin_two = _gat._getTracker(“UA-XXXXXXXX-X”);
Olay tamamdır.