Broken links or 404 errors on your website is one of the most annoying experience from user perspective. This may discourage user to return to your website which is not good for Marketing/Branding. From developer or owner end, it may not be easy to keep track of all broken links every time the website content changes.
Here is an alternative solution that uses modern tracking tools like Google Analytics to serve the purpose. It relies on creation of default 404 error page & add the below tracking code on 404 page itself.
var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXXXX-A']); _gaq.push(['_trackEvent', 'Error', '404', 'page: ' + document.location.pathname + document.location.search + ' ref: ' + 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); })();
(Visited 247 times, 1 visits today)