diff --git a/index.html b/index.html
index 4ea9d9721..2f3b5fb91 100644
--- a/index.html
+++ b/index.html
@@ -182,7 +182,18 @@ _gaq.push(['_trackPageview']);
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);
+
+ // javascript errors
+ var lastev = '';
+ window.onerror = function(message, file, lineNumber) {
+ var ev = ['_trackEvent', 'error', file + ':' + lineNumber, message + ''];
+ if (ev.join(',') !== lastev) {
+ _gaq.push(ev);
+ lastev = ev.join(',');
+ }
+ };
})();
+