Skip to content

Instantly share code, notes, and snippets.

@jerkovicl
Last active April 4, 2023 18:36
Show Gist options
  • Save jerkovicl/cba382b2b98e2ee3470f to your computer and use it in GitHub Desktop.
Save jerkovicl/cba382b2b98e2ee3470f to your computer and use it in GitHub Desktop.
Google Analytics Custom Event Tracking
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
_gaq.push(['_trackEvent', 'api error', 'api_name', 'status code: ' + jqXHR.status]);
function noErrorMa() {
return true;
}
window.onerror = noErrorMa;
window.onerror = function (errorMsg, url, lineNumber, column, errorObj) {
if (errorMsg.indexOf('Script error.') > -1) {
return;
}
alert('Error: ' + errorMsg + ' Script: ' + url + ' Line: ' + lineNumber
+ ' Column: ' + column + ' StackTrace: ' + errorObj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment