I use Google Analytics for my own site and other sites I work on as well. But I never quite figured out how to get an overview with exit links in Google Analytics. Sure, there is the list of exit pages. But that doesn't tell you exactly where the user has gone to. I googled for a solution and found this wonderful piece of javascript from Danny Ng. I prefer working with the Prototype javascript framework and therefore I decided to rewrite it.

var ExitTracker = Class.create({
	initialize: function()
	{
		this.domain = document.location.toString().toLowerCase().split("/")[2];
 
		$$("a").each(function(item)
		{
			if (item.href && (item.href != (document.location + "#")))
			{
				$(item).observe("click", this.track.bindAsEventListener(this));
			}
		}.bind(this));
	},
 
	track: function(e)
	{
		var el = e.element();
		var exit_domain = el.href.split("/")[2].toLowerCase();
 
		if (this.domain.toLowerCase().indexOf(exit_domain) == -1)
		{
			if (typeof pageTracker != "undefined")
			{
				pageTracker._trackPageview("/exit/" + el.href);
			}
		}
	}
});

Just save the code above as exittracker.js and insert the following right before the </body> tag and right after your Google Analytics code:

<!-- Google Analytics code here -->
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="exittracker.js"></script>
<script type="text/javascript">
new ExitTracker();
</script>
 

Don't forget to replace prototype.js in the snippet above with the location you saved prototype.js to. If you don't have prototype.js, you can get it here.