Forum Moderators: Robert Charlton & goodroi
Unlike many people, I've been getting the long-form Google URLs almost exclusively for a long time. So if I search on "google" and hover on the headline, in my status bar, it shows a URL like:
http://www.google.com/url?sa=t&source=web&ct=res&cd=4&url=http%3A%2F%2Fwww.google.com
%2F&ei=OewWSsXFFKTgtAOJjdiSDw&usg=AFQjCNG5-9Jej-ukVeakTgwonqt2narbYg&sig2=4Lwo00y104At7P9SCT7uXA
I use the "My Library" feature of Google books a lot, so I'm often signed into a Google account. I'm not sure if that matters. I do have "search history" turned off and all that, but I suspect being logged in changes things.
Anyway, lately I've been noticing more URLs that are actually just the destination. So for the "google" search, I hover on the link, and it's just like it used to be: http://www.google.com which matches the link given at the bottom of the result.
Now here's where it gets interesting: if you CLICK on the link, it is transformed into the long form. Normally if you just click, you wouldn't see this and wouldn't know that Google is using Javascript to rewrite the URL *client* side *before* submitting the GET request.
The way I noticed is that if you *right* click, it fires the event and the URL gets transformed. So I haven't left the page and when I hover over a link that I have right clicked, I now get the long form in the status bar. In other words, there's some DOM scripting that is actually changing the URL.
A little look at the source code show that it fires on the OnMouseDown event.
So the URL looks like this:
<a href="http://www.google.com/" class=l onmousedown="return rwt(this,'','','res','4',
'AFQjCNG5-9Jej-ukVeakTgwonqt2narbYg','&sig2=4Lwo00y104At7P9SCT7uXA')">
In the doc head, the rwt function is defined as:
window.rwt=function(a,d,e,g,h,f,i,j){
try {
if(a===window) {
a=window.event.srcElement;
while(a){
if(a.href)break;
a=a.parentNode
}
}
var b=encodeURIComponent¦¦escape,c=a.href.split("#"),k=["/url?sa=t\x26source\x3dweb",d?"&oi="+b
(d):"",e?"&cad="+b(e):"","&ct=",b(g¦¦"res"),"&cd=",b(h),"&url=",b(c[0]).replace(/\+/
g,"%2B"),"&ei=","3cgWSoiDAZmWswOEhvTZCA",f?"&usg="+f:"",i,c?"#"+c[1]:""].join("");a.href=k;
a.onmousedown=""
}
catch(l){}
return true
};
[edited by: tedster at 7:12 pm (utc) on May 22, 2009]
[edit reason] added line breaks to prevent side-scroll [/edit]
No time right now to dig in further, but it appears that the one "click" on the displayed URL results in both HTTP requests "in parallel"... i.e. this is NOT a redirect through Google.
Jim
From my understanding, what's actually happening in the Google code is:
1) User clicks link.
2) Because onclick is executed before href is visited, code is executed, with HTTP request sent to Google for tracking and an HTTP 204 response is given.
3) Because of the 204 response (and because the javascript doesn't return false), the browser does not redirect anywhere and continues to execute the click event, the next step of which is visiting the href i.e the listing.
So the two request don't happen in parallel. The tracking is done directly before the visit to the site.
Time to reread the HTTP spec to see what else I don't know about :)
[edited by: Chico_Loco at 4:38 am (utc) on May 27, 2009]
Click Tracking at Google (Hidden) [webmasterworld.com]
One way to see the actual link is to click on a result and then go back to the results page - the destination will have changed (as reported [webmasterworld.com] by a member last year).
I believe most of the 204s are unrelated to click tracking (e.g. requests to clients.google.com). I think this is just general analytics or similar.
It's funny, because based on what I've read here, I was getting served the "long form" URLs relatively early and often compared to others, but this is a new behavior for me.
Google's onclick SERP tracking has been around for a long time. I think there was even a deconstruction of it on the WebmasterWorld few years ago.
Recently, they changed the redirects at /url to be client-side, rather than server-side, for a significant proportion of users - and went as far as announcing this publicly.
I believe that I've seen tests of this for a long period; many who use a variety of web analytics packages will have seen odd Google referrals at one point or another. Some are as a result of analytics software not being able to interpret the different referring URLs.
Personally, I think the change is because of a different requirement for data collection at Google - i.e. someone needed them to change this to record a certain type of data - or tie new data into an existing system.