Tracking external/outbound links with Google Analytics & jQuery

For a related project we have undertaken whilst working on
ReservationLive, we have needed to track clicks for external links.
There are a few solutions available after a quick Google search, but
most rely on either the old "urchin" analytics code, or the newer
"ga.js" tracking code. Google recently released an asynchronous
version of their tracking code, and our solution works with that.
You'll also need the ubiquitous jQuery for this solution, but it is
assumed you have that already.

First of all, one will need to attach the 'rel' attribute to the
anchor element for external links, we're using 'external' as this
makes semantic sense.

Now, we need jQuery to pass the URL of the link to Google Analytics
when an external link is clicked. We do that with this snippet:

As you can see, all external links appear as if they are linking to
local resources in the '/outgoing/' directory of our webserver; you
can customise this as you wish. You will need to wait at least 24
hours for the new links to show up in the 'Content Overview' section
of Google Analytics.

Happy tracking!