A better way to track clicks

Since I work for a marketing company, metrics are obviously extremely important to our clients. So this involves not only tracking pageviews and conversions, but sometimes clicks on buttons, links, etc.

Now while tracking clicks is fairly straightforward, I have had some inconsistancies when using multiple methods of tracking. Such as DAC Group's built-in solution: DiMITRI, Google Analytics, and Omniture's Test and Target. To send three cross domain requests before a link completes its go through can be a bit tricky. So I like to use our good friend jQuery.

Using some of the above technologies, a click might be tracked like so:

$('#external-link').click(function(() {
  _gaq.push(['_trackPageview', '/external-click']);
  mboxUpdate('myMbox', 'conversion=click');
});

In this case, the methods will fire, and GA will probably capture that, however test and target won't always. So what I like to do is tell the browser to not follow the link, and then redirect when I tell it to:

$('#external-link').click(function((e) {
   e.preventDefault();
   _gaq.push(['_trackPageview', '/external-click']);
   mboxUpdate('myMbox', 'conversion=click');
   window.location.href = $(this).attr('href');
});

This works a lot more reliably. Google suggests something kind of similar, where you would delay the redirect using a setTimeout: http://www.google.com/support/analytics/bin/answer.py?answer=55527