Skip to content

Instantly share code, notes, and snippets.

@tcorral
Forked from shfx/ga-track-errors.js
Created December 9, 2013 15:27

Revisions

  1. @shfx shfx renamed this gist Nov 14, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @shfx shfx created this gist Nov 14, 2013.
    6 changes: 6 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    window.onerror = function(message, url, linenumber) {
    try{
    _gaq.push(['_trackEvent', 'Error', 'JS', JSON.stringify({'refurl': document.location.href, 'url': url.replace(/\?\d+$/, ''), 'line': linenumber, 'message': message})]);
    } catch (e) {}
    return true;
    };