Google Analytics - Track Javascript errors

(function(window){ var undefined, link = function (href) { var a = window.document.createElement('a'); a.href = href; return a; }; window.onerror = function (message, file, line, column) { var host = link(file).hostname; ga('send','event', (host == window.location.hostname || host == undefined || host == '' ? '' : 'external ') + 'error', message, file + ' LINE: ' + line + (column ? ' COLUMN: ' + column : ''), {'nonInteraction': 1}); }; }(window));
Track Javascript errors using UA

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.