Skip to content

Instantly share code, notes, and snippets.

@tcorral
Forked from shfx/ga-track-errors.js
Created December 9, 2013 15:27
Show Gist options
  • Save tcorral/7873944 to your computer and use it in GitHub Desktop.
Save tcorral/7873944 to your computer and use it in GitHub Desktop.
window.onerror = function(message, url, linenumber) {
try{
_gaq.push(['_trackEvent', 'Error', 'JS', JSON.stringify({'refurl': document.location.href, 'url': url.replace(/\?\d+$/, ''), 'line': linenumber, 'message': message})]);
} catch (e) {}
return true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment