Tracking lost users w/ Google Analytics
Step 1: Set up your custom 404-page, put this in .htaccess:
ErrorDocument 404 /404.html
Step 2: Put this Google Analytics code on your 404.html:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-19487197-1']);
_gaq.push(['_trackPageview', '/404'+ '?page=' + document.location.pathname + document.location.search + '&from=' + document.referrer]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
That way, you catch both that you had an error, what path they tried to access and where the bad link is.