Last active
October 18, 2018 21:14
-
-
Save dcvogi/b22acd16ae3c14f56955add75328fa24 to your computer and use it in GitHub Desktop.
Track the on-page errors on 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
(function errorTracking() { | |
window.onerror = function(msg, url, lineNo, columnNo, error) { | |
var errorStack = error ? JSON.stringify(error.stack) : 'stack unavailale'; | |
var content = [ | |
msg, url, lineNo, columnNo, errorStack | |
].join(' - '); | |
ga('send', 'event','error tracking', content); | |
return false; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment