oaeproject/3akai-ux — pull request #3724 by sathomas (2014-04-14 12:18:21+00:00)
Title: Track JavaScript Errors with Google Analytics

Since we have the capability to use Google Analytics, we ought to also use it to track JavaScript errors in the UI. Not as fancy as the purpose-built services such as [errorception](https://errorception.com), but easy to add via GA custom events:

```
// Add event handler to track JavaScript errors
window.addEventListener('error', function(e) {
ga('send', 'event', 'JavaScript Error', e.message + ' [' + e.filename + ': ' + e.lineno + ']');
});

// Add event handler to track jQuery AJAX errors
$(document).ajaxError(function(e, request, settings) {
ga('send', 'event', 'Ajax Error', settings.url + ' => ' + e.result);
});
```