Created
September 14, 2012 12:55
-
-
Save vsr/3721754 to your computer and use it in GitHub Desktop.
JavaScript error logging with GA
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
| // Google Analytics event tracking (Report available at Content->Events in GA) | |
| function gatrack(){ | |
| var args = Array.prototype.slice.call(arguments), | |
| params = ['_trackEvent'].concat(args); | |
| if(typeof _gaq !== 'undefined') { | |
| window.setTimeout(function(){ _gaq.push(params); }, 0); | |
| } | |
| } | |
| window.onerror = function(msg, url, line){ | |
| gatrack('jserror', url+':'+line, msg); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment