Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deguchi/4583299 to your computer and use it in GitHub Desktop.
Save deguchi/4583299 to your computer and use it in GitHub Desktop.
window.onerror = function(mes,file,num){
track_jserror(mes,file,num);
return false;
}
function track_jserror(mes,file,num){
if("_gaq" in window){
_gaq.push(['_trackEvent', 'Javascript', 'Error', [
"file : " + file,
"line : " + num,
"message : " + mes
].join(" ")]);
}else{
setTimeout(function(){
track_jserror(mes,file,num);
}, 1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment