To get started, you need to configure Raven.js to use your Sentry DSN:


At this point, Raven is ready to capture any uncaught exception.

Optional settings

Raven.config() can optionally be passed an additional argument for extra configuration:

Raven.config('___PUBLIC_DSN___', {
    release: '1.3.0'

Those configuration options are documented below:


The name of the logger used by Sentry. Default: javascript

  logger: 'javascript'

Track the version of your application in Sentry.

  release: '721e41770371db95eee98ca2707686226b993eda'

Can also be defined with Raven.setRelease('721e41770371db95eee98ca2707686226b993eda').


New in version 1.3.0.

Typically this would be the server name, but that doesn’t exist on all platforms. Instead you may use something like the device ID, as it indicates the host which the client is running on.

  serverName: device.uuid

Additional tags to assign to each event.

  tags: {git_commit: 'c0deb10c4'}

The inverse of ignoreUrls. Only report errors from whole urls matching a regex pattern or an exact string. whitelistUrls should match the url of your actual JavaScript files. It should match the url of your site if and only if you are inlining code inside <script> tags. Not setting this value is equivalent to a catch-all and will not filter out any values.

Does not affect captureMessage or when non-error object is passed in as argument to captureException.

  whitelistUrls: [/getsentry\.com/, /cdn\.getsentry\.com/]

Very often, you will come across specific errors that are a result of something other than your application, or errors that you’re completely not interested in. ignoreErrors is a list of these messages to be filtered out before being sent to Sentry as either regular expressions or strings.

Does not affect captureMessage or when non-error object is passed in as argument to captureException.

  ignoreErrors: ['fb_xd_fragment']

The inverse of whitelistUrls and similar to ignoreErrors, but will ignore errors from whole urls matching a regex pattern or an exact string.

  ignoreUrls: [/graph\.facebook\.com/, '']

Does not affect captureMessage or when non-error object is passed in as argument to captureException.


An array of regex patterns to indicate which urls are a part of your app in the stack trace. All other frames will appear collapsed inside Sentry to make it easier to discern between frames that happened in your code vs other code. It’d be suggested to add the current page url, and the host for your CDN.

    includePaths: [/https?:\/\/getsentry\.com/, /https?:\/\/cdn\.getsentry\.com/]

A function that allows mutation of the data payload right before being sent to Sentry.

    dataCallback: function(data) {
      // do something to data
      return data;

A callback function that allows you to apply your own filters to determine if the message should be sent to Sentry.

    shouldSendCallback: function(data) {
      return false;

By default, Raven does not truncate messages. If you need to truncate characters for whatever reason, you may set this to limit the length.


Override the default HTTP data transport handler.

Alternatively, can be specified using Raven.setTransport(myTransportFunction).

    transport: function (options) {
        // send data

The provided function receives a single argument, options, with the following properties:

The target url where the data is sent.

The outbound exception data.

For POST requests, this should be JSON-encoded and set as the HTTP body (and transferred as Content-type: application/json).

For GET requests, this should be JSON-encoded and passed over the query string with key sentry_data.


An object representing authentication data. This should be converted to urlencoded key/value pairs and passed as part of the query string, for both GET and POST requests.

The auth object has the following properties:

The API version of the Sentry server.
The name and version of the Sentry client of the form client/version. In this case, raven-js/${Raven.VERSION}.
Your public client key (DSN).
Callback to be invoked upon a successful request.
Callback to be invoked upon a failed request.

By default, Raven.js will throw an error if configured with a Sentry DSN that contains a secret key. When using Raven.js with a web application accessed via a browser over the web, you should only use your public DSN. But if you are using Raven.js in an environment like React Native or Electron, where your application is running “natively” on a device and not accessed at a web address, you may need to use your secret DSN string. To do so, set allowPrivateKey: true during configuration.

Putting it all together

<!doctype html>
    <title>Awesome stuff happening here</title>
    <script src="jquery.min.js"></script>
    <script src=""></script>
        Raven.config('___PUBLIC_DSN___', {
            logger: 'my-logger',
            whitelistUrls: [
            ignoreErrors: [
            includePaths: [
    <script src="myapp.js"></script>