A lot of site owners want to track outbound links so they can see how often they are clicked. It's also useful to see when and where people left your site. Google Analytics knows the exit time of your last page, where in normal cases the last visited page is not counted in the spend time on site/page.
But, there is a big but. A lot of outbound link tracking is done like this:
[code lang="html"]<a href="http://andrescholten.net" onclick="trackClick(this)">Nice site</a>
And this is what happens when you click on this outbound link:
- The onclick is executed first
- The trackClick function generates an IMG element with a URL that points to the Web Analytics vendor
- The onclick function is handled and the browser starts with the href part
And then the race starts: