Created
May 21, 2016 15:17
-
-
Save vernondegoede/04572a846a82d64ecfa35d770e65b6ca to your computer and use it in GitHub Desktop.
Send 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
// Send errors to Google Analytics | |
window.onerror = (msg, file, line, column, error=null) => { | |
try { | |
if (error) msg = error.stack; | |
ga('send', 'event', 'error', '${file}:${line}', msg); | |
} catch (e) { | |
// Do nothing | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment