JavaScript error logging with GA
// Google Analytics event tracking (Report available at Content->Events in GA)
function gatrack(){
var args = Array.prototype.slice.call(arguments),
params = ['_trackEvent'].concat(args);
if(typeof _gaq !== 'undefined') {
window.setTimeout(function(){ _gaq.push(params); }, 0);
}
}
window.onerror = function(msg, url, line){
gatrack('jserror', url+':'+line, msg);
};