Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rakeshpai/1147102 to your computer and use it in GitHub Desktop.
Save rakeshpai/1147102 to your computer and use it in GitHub Desktop.
Errorception tracking snippet - extra verbosity edition
<script>var _errs=["<application id here>"];(function(a,b){if(b.location.protocol!="https:"){a.onerror=function(a,c,b)
{_errs.push({m:a,u:c,l:b});return!1};var d=function(){var a=b.createElement("script"),
c=b.getElementsByTagName("script")[0];a.src="http://errorception.com/projects/"+_errs[0]+"/beacon.js";c.parentNode.insertBefore(a,c)};
a.addEventListener?a.addEventListener("load",d,!1):a.attachEvent("onload",d)}})(window,document);</script>
<!--
Note: DO NOT use this script - it is too verbose.
You will have a minified version of this script available to you in your admin settings.
-->
<script>
var _errs = ["<application id here>"]; // This is the error "queue" - the only variable we add in the global namespace
(function (window, document) {
// This self-executing function lets us control scope better,
// and gives us better compressibility using common minifiers.
if (document.location.protocol != "https:") { // For now, we aren't supporting https
window.onerror = function (msg, url, line) {
_errs.push({m: msg, u: url, l: line}); // Push new errors into the queue as they occur
return false;
};
var loader = function () {
var script = document.createElement("script"), tag = document.getElementsByTagName("script")[0];
script.src = "http://errorception.com/projects/" + _errs[0] + "/beacon.js";
tag.parentNode.insertBefore(script, tag);
};
// Wait until window.onload before downloading any more code.
window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
}
})(window, document);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment