Created
June 4, 2016 23:37
-
-
Save krvajal/798834d8e8eaae37c7b0150b443e242e to your computer and use it in GitHub Desktop.
Report js errors to google analytics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onerror = (msg, file, line, column, error=null)=>{ | |
try{ | |
if(error){ // error param not supported everywhere | |
msg = error.stack; | |
} | |
ga('send','event','error', `${file}:{line}`, msg) | |
}catch(e){ | |
// no-op | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment