Posted By

pauliehaha on 11/19/10


Tagged

Analytics


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

AllKnightAccess
tonicglop


Log Errors to Google Analytics


 / Published in: JavaScript
 

  1. function doSomething() {
  2. try { alert('foo'); } catch(err) { handleError(err, arguments.callee.toString() ?? 'anon' ); }
  3. }
  4.  
  5.  
  6. function handleError(err, func) {
  7. var s = [];
  8. for (var i in err) { s.push(i + '=' + err[i]); }
  9. s = s.join(' ').substr(0,500)
  10. pageTracker._trackEvent("Error", func, s);
  11. }

Report this snippet  

You need to login to post a comment.