Collecting events from browsers

The easiest way to include the Desole client library into your web pages is to add the following snippet before any other scripts in your web pages. A good place to put it would be the start of the HEAD element.

<script src="https://desole.io/code/1.0.0/client-min.js" crossorigin="anonymous" integrity="sha384-RJpzB9k3WRLZZ0Th8DoSiEWUYMmt5+9fxLajledFE5PY/23D+tHatLo38g/LDc7z"></script>
<script>
  var desole = new Desole({
    url: 'https://DESOLE-API-URL', 
    app: {
      name: 'Desole test',
      version: '1.0.0',
      stage: 'test'
    }
  })
</script>

Remember to change the configuration to your Desole API URL, application name, version and stage. You can find your Desole API URL in the CloudFormation template outputs after deploying the Desole Collector API into your AWS account.

If you’d like to bundle the Desole code with your app instead of loading the code from the CDN, you can install the library using:

npm install @desole/client

This will make Desole automatically track unhandled errors on the page, as well as script loading errors. To track errors manually, use instance created with new Desole and call the captureException to send an exception object or a promise rejection to the collector API:

try {
  throw new Error('capturedException');
} catch (e) {
  desole.captureException(e);
}

Collecting events from other types of apps

The first release of Desole only has a client for browser-side JavaScript, we plan to publish clients for other platforms soon. Meanwhile, you can easily post events from other types of applications by using any HTTPS client.

For applications outside your AWS account, you can submit error information directly to the Desole API URL using a HTTPS post with the content type application/json format. For applications running inside your AWS account, you can reduce costs by directly submitting event information to the collector SNS topic. (You can find both your Desole API URL and the Collector SNS Topic in the CloudFormation template outputs after deploying the Desole Collector API into your AWS account.)

Check out the Desole Event Format Documentation and Example events.