Client-side error logging with Google Event Tracking

Thanks to this article: Client-Side Error Logging With Google Analytics I started an experiment yesterday with logging client-side JavaScript errors as an event in Google Analytics in 3 lines of code. Within a couple hours, I could generate a report of which scripts were causing the most errors, what the errors are, which pages and/or which browsers have the most errors. I still think it would be a good idea to have a dedicated solution, but in the meantime this is a great way to get an instant picture of the current situation.

Here’s the code I’m using in case you want to give it a try.

window.onerror = function(message, file, line) {
   _gaq.push(['_trackEvent', 'JS Error', file + ':' + line + '\n\n' + message]);
};

Related Reading

 
171
Kudos
 
171
Kudos

Read this next

OmniFocus 2 iPad Review

My biggest question as a long-time OmniFocus user when I realized that OmniFocus 2 for iPad had been released for $29.99 + a $19.99 in-app purchase, was: is OmniFocus worth the price of entry (to me)? This post started with the intention... Continue →