A jQuery plugin aimed at making it easier to track outbound links with Google Analytics.
Download the production version or the development version.
99% of the time you'll probably just want to track clicks on all outbound links on a page. This is easy. In your web page:
<script src="jquery.js"></script>
<script src="dist/jquery.outbound-analytics.min.js"></script>
<script>
jQuery(function($) {
// automatically tracks all outbound links (a[href]) in the DOM
$.outboundAnalytics();
});
</script>
Sometimes you may want to track only certain links, or track links in your header or footer different. This is easy, too. In your web page:
<script src="jquery.js"></script>
<script src="dist/jquery.outbound-analytics.min.js"></script>
<script>
jQuery(function($) {
// automatically tracks all outbound links (a[href]) in <header>
$('header').outboundAnalytics();
// track <aside> links as 'Reference Links'
$('aside').outboundAnalytics({ 'category': 'Reference Links' });
});
</script>
- 0.1.1: Improving external link detection.
- 0.1.0: Intial release.