Ask HN: Why does Google search redirect links instead of using JavaScript?

2 points by thinkloop ↗ HN
I am sure you have noticed that google search results point to a google.com link first instead of the actual result directly. This comes with a heavy price in terms of speed and usability.

Why does google not instead silently track the link using JavaScript when JavaScript is available? Is it in case of link sharing? If so, is that not an overly heavy cost for an uncommon use-case?

2 comments

[ 4.0 ms ] story [ 12.4 ms ] thread
I'm not seeing that. Searching for "honda motorcycles" I get a page of links that look like this:

  <a href="https://global.honda/products/motorcycles.html" ping="/url?sa=t&amp;source=web&amp;rct=j&amp;url=https://global.honda/products/motorcycles.html&amp;ved=2ahUKEwiZ_IK6wsLrAhVDHjQIHVtRC0EQFjAKegQIBBAB"><br><h3 class="LC20lb DKV0Md">Motorcycles - Honda Global</h3><div class="TbwUpd NJjxre"><cite class="iUh30 gBIQub bc tjvcx">global.honda<span class="eipWBe"> › products › motorcycles</span></cite></div></a>
It uses the ping attribute to track the clicks. Sponsored ad links look a little different.

I'm using Chrome. I don't think the ping attribute is supported in all browsers so in other browsers Google most likely does the redirect to accomplish the same thing -- track clicks on search result links and capture whatever it can get from the browser.

You can't just "silently track the link using JavaScript." One way or another Google is going to track clicks on search results, whether through a redirect, a ping, or JS code sending an AJAX request. However you look at it your browser is going to make at least one additional HTTP request along with following the link.

I had noted the same in the past. It does not seem to happen on latest chrome. As another user pointed, it could be browser specific.