Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save googleanalyticsresoneo/1122816 to your computer and use it in GitHub Desktop.
Save googleanalyticsresoneo/1122816 to your computer and use it in GitHub Desktop.
JS Exceptions tracked in GA Events
function trackErrorThroughEvent(exception, fct) { /* remontée des erreurs éventuelles pour détection des pbs */
_gaq.push(['_trackEvent', 'Erreur JS ' + (fct || 'native'), exception + ' name: ' + (exception.name || 'Error') + ' #mess: ' + (exception.message || 'n/a') + ' #nav: ' + navigator.userAgent , ' #url: ' + document.location.href + '#ref: ' + document.referrer ,,true ]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment