Link to Github page: https://github.com/understand/understand-js
1) Install it using Yarn:
yarn add @understand/understand-js
or Npm:
npm install @understand/understand-js
or include the library from our CDN:
<script src="https://cdn.understand.io/understand-js/v1/bundle.min.js" crossorigin="anonymous"></script>
2) Initialise the library and configure it:
<script>
Understand.init({
env: 'production', // define environment
token : 'your-input-token-from-your-account'
}).catchErrors()
</script>
Or if you're using module bundlers such as Webpack/Browserify/Rollup/etc.
import Understand from '@understand/understand-js';
Understand.init({
env: 'production', // define environment
token : 'your-input-token-from-your-account'
}).catchErrors();
3) Send your first error to Understand.io
try {
throw new Error('The first error!');
} catch (e) {
Understand.logError(e);
}