Handling JavaScript errors with Google Analytics
// https://developers.google.com/analytics/devguides/collection/analyticsjs/exceptions
window.onerror = function(errorMsg, url, line, lineColumn, errorObj) {
ga('send', 'exception', {
'errorMsg': errorMsg,
'url': url,
'line': line,
'lineColumn': lineColumn,
'errorObj': JSON.stringify(errorObj)
});
};