Simply add a javascript file to your project and javascript errors on your site will be logged on jssavior.com.
Complete doc available on jssavior.com/setup
-
Create an account and log in on jssavior.com
-
Create a project
-
Add the javascript file jssavior.min.js in your project (this file should be the first javascript file to load in your project, ideally the first script to be loaded in the header)
<script src="//cdn.jsdelivr.net/jssavior/latest/jssavior.min.js"></script>
If you want to load jssavior asynchronously and catch errors happening before the file is loaded, add this code at the beginning of the body of the site :
window.onerror = function(message,file,line, column, errorObj) {
JSSaviorConfig.errorQueue.push({
column: column,
errorObj: errorObj,
file: file,
line: line,
message: message
});
};
- Add the ID of your project right above the code from step 3
<script>
var JSSaviorConfig = {
projectId: 'xxxxxxxxx',
errorQueue: []
};
</script>
-
Go to your project and add the domain that you will log your errors from. If there is a javascript error in your project and the domain is not listed in the project's domains list, the error will not be logged.
-
That's it! JSSavior is now ready to log your bad coding! :)