Last active
August 30, 2017 19:21
-
-
Save jrobinsonc/e5ef407ab3b02cd8d1f670e742f270ce to your computer and use it in GitHub Desktop.
Handling JavaScript errors with Google Analytics
This file contains hidden or 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
// https://developers.google.com/analytics/devguides/collection/analyticsjs/exceptions | |
window.onerror = function(errorMsg, url, line, lineColumn, errorObj) { | |
ga('send', 'exception', { | |
'errorMsg': errorMsg, | |
'url': url, | |
'line': line, | |
'lineColumn': lineColumn, | |
'errorObj': JSON.stringify(errorObj) | |
}); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment