As the question states, I'm trying to figure out how google tracks clicks on search results. When you view the source, you find the following:
<a href="http://www.yahoo.com/" class=l onmousedown="return rwt(this,'','','res','1','AFQjCNG7Ba-stir4109vlLygPQX7QGf8bg','&sig2=Vx5PLxf04C-yJYZTZfvk8w')"><em>Yahoo</em>!</a>
The function rwt
is, which is pretty messy:
windows.rwt=function(b,d,e,g,h,f,i,j){
var a=encodeURIComponent||escape,c=b.href.split("#");
b.href=["/url?sa=t\x26source\x3dweb",d?"&oi="+a(d):"",e?"&cad="+a(e):"","&ct=",a(g),"&cd=",a(h),"&url=",a(c[0]).replace(/\+/g,"%2B"),"&ei=7_C2SbqXBMW0-AbU4OWnCw",f?"&usg="+f:"",i,c[1]?"#"+c[1]:""].join("");
b.onmousedown="";
return true};
So it looks like Google is changing the href of the a tag to /url?...
which I'm assuming is where their tracking is. From LiveHeaders in Firefox, it looks like this page is redirecting the browser to the original href of the a tag.
Is this correct and is this the best method of tracking clicks on links on your site, such as ads?