Revision: 45920
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 11, 2011 02:17 by cristinachetroi
Initial Code
<script>
(function(){
var old = window.onerror;
window.onerror = function (msg, url, line) {
if(typeof old==="function") { old(msg,url,line);}
_gaq.push(['_trackEvent', 'Error Log', msg, url+'_'+line]);
};
}());
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXXX-Y']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Initial URL
http://dl.dropbox.com/u/397675/error_test.html
Initial Description
1. no need to wrap the (potentially) offending code in try/catch 2. use window.onerror:
Initial Title
Debugging JS with GA by Yahel Carmon
Initial Tags
Initial Language
JavaScript