44 <a ping>: accurate link tracking

Posted: Jan 23, 2006, under Software, Standards. Add a comment!

Darin Fisher is one of the developers that work for the Mozilla Foundation. He made the news one year ago (January 2005) when he was employed by Google. He has kept working on Mozilla code as well, and this is about one of his latest contributions.

WhatWG is a, well, working group, which strives to expand (X)HTML in ways that have become painfully needed these last few years. One of their recent proposals includes the ping attribute for the <a> tag. Here’s a straight quote about how it works:

The ping attribute, if present, gives the URIs of the resources that are interested in being notified if the user follows the hyperlink. The value must be a space separated list of one or more URIs.

Darin has already started implementing this attribute in trunk builds of Firefox, as an experiment. To date, Firefox is the only browser implementing this, and only in these test versions which may never be shipped as such to users.

Link tracking is a very valuable instrument on the Web. It’s very useful and very important for a website owner to know exactly what links their visitors follow, what page they were reading when they did this, and when they did it. This helps them figure out the trails that visitors take along their sites as well as how their attention shifts, and to adjust their content accordingly.

It is also an instrument used heavily in online advertising, since in that context the thing that needs click tracking is an advertising banner. This is actually the source of much of the criticism that <a ping> has seen so far: it is percieved mainly as a means to aid marketers. Which is not true, as I’ve said above: all sites can use link tracking, not just banner-serving engines.

You may wonder how link tracking is done right now. It is not a trivial matter, come to think about it. Naturally, as a site owner, you want to get your notifications every time a link is clicked, but at the same time you want links to reflect the “real” address they should point at. This is because people may choose to look at the stats bar as they hover the link, or right-click and choose “copy link” in their browser. And you don’t want them to get the “fake” link that only serves to record a hit on your link tracker.

Currently, link tracking is done mainly by redirection. The site either offers the fake links directly (with all the negative side-effects), or uses JavaScript tricks such as intercepting clicks with onMouseDown() and replacing the target URL at the last moment. Choose your poison: incorrect links or JavaScript addiction. Both of which result in the user having to pass through a single point of failure, which can also prove to be a bottleneck: the link tracker. Should the tracker die or slow down, all links on the site are affected.

By contrast, the <a ping> implementation proposed by Darin Fisher uses an asynchronous approach: the browser would first of all let the user see the actual URL they should see and get on with their business. While in the background it would attempt to notify the tracker, but failure to do so would not hinder the user in any way.

Add the posibility to turn this feature off (perhaps even on a site-by-site basis) and you get a tracking mechanism which very much resembles cookies. A very promising feature indeed.

It’s worth noting that there are already Firefox extensions which take <a ping> into consideration. Such an example is NoScript, an extension which offers site-by-site control over Java and Flash, which recently also implemented ping support.