title: How does Google track search result clicks? Is this the best way?
body: <p>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:</p>
  
  <pre><code> &lt;a href="http://www.yahoo.com/" class=l onmousedown="return rwt(this,'','','res','1','AFQjCNG7Ba-stir4109vlLygPQX7QGf8bg','&amp;amp;sig2=Vx5PLxf04C-yJYZTZfvk8w')"&gt;&lt;em&gt;Yahoo&lt;/em&gt;!&lt;/a&gt;
  </code></pre>
  
  <p>The function <code>rwt</code> is, which is pretty messy:</p>
  
  <pre><code>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?"&amp;oi="+a(d):"",e?"&amp;cad="+a(e):"","&amp;ct=",a(g),"&amp;cd=",a(h),"&amp;url=",a(c[0]).replace(/\+/g,"%2B"),"&amp;ei=7_C2SbqXBMW0-AbU4OWnCw",f?"&amp;usg="+f:"",i,c[1]?"#"+c[1]:""].join("");
  b.onmousedown="";
  return true};
  </code></pre>
  
  <p>So it looks like Google is changing the href of the a tag to <code>/url?...</code> 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.</p>
  
  <p>Is this correct and is this the best method of tracking clicks on links on your site, such as ads?</p>