---
title: "Options"
description: "Learn more about how the Sentry JavaScript SDK can be configured via options. These are being passed to the init function and therefore set when the SDK is first initialized."
url: https://docs.sentry.io/platforms/javascript/guides/cordova/configuration/options/
---

# Options for Cordova

## [Available Options](https://docs.sentry.io/platforms/javascript/configuration/options.md#available-options)



## [Core Options](https://docs.sentry.io/platforms/javascript/configuration/options.md#core-options)

### [dsn](https://docs.sentry.io/platforms/javascript/configuration/options.md#dsn)

| Type | `string` |
| ---- | -------- |

The DSN tells the SDK where to send the events. If this is not set, the SDK will not send any events. Learn more about [DSN utilization](https://docs.sentry.io/concepts/key-terms/dsn-explainer.md#dsn-utilization).

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
});
```

### [debug](https://docs.sentry.io/platforms/javascript/configuration/options.md#debug)

| Type    | `boolean` |
| ------- | --------- |
| Default | `false`   |

Turns debug mode on or off. If debug is enabled SDK will attempt to print out useful debugging information about what the SDK is doing.

### [release](https://docs.sentry.io/platforms/javascript/configuration/options.md#release)

| Type | `string` |
| ---- | -------- |

Sets the release. Release names are strings, but some formats are detected by Sentry and might be rendered differently. Learn more about how to send release data so Sentry can tell you about regressions between releases and identify the potential source in [the releases documentation](https://docs.sentry.io/product/releases.md) or the [sandbox](https://sandbox.sentry.io/?scenario=releases\&projectSlug=react\&source=docs).

In the browser, the SDK will try to read this value from `window.SENTRY_RELEASE.id` if available.

### [environment](https://docs.sentry.io/platforms/javascript/configuration/options.md#environment)

| Type    | `string`     |
| ------- | ------------ |
| Default | `production` |

Sets the environment. Defaults to `development` or `production` depending on whether the application is packaged.

Environments tell you where an error occurred, whether that's in your production system, your staging server, or elsewhere.

Sentry automatically creates an environment when it receives an event with the environment parameter set.

Environments are case-sensitive. The environment name can't contain newlines, spaces or forward slashes, can't be the string "None", or exceed 64 characters. You can't delete environments, but you can hide them.

### [tunnel](https://docs.sentry.io/platforms/javascript/configuration/options.md#tunnel)

| Type | `string` |
| ---- | -------- |

Sets the URL that will be used to transport captured events. This can be used to work around ad-blockers or to have more granular control over events sent to Sentry. Adding your DSN is still required when using this option so necessary attributes can be set on the generated Sentry data. This option **requires the implementation** of a custom server endpoint. Learn more and find examples in [Dealing with Ad-Blockers](https://docs.sentry.io/platforms/javascript/troubleshooting.md#dealing-with-ad-blockers).

### [maxBreadcrumbs](https://docs.sentry.io/platforms/javascript/configuration/options.md#maxBreadcrumbs)

| Type    | `number` |
| ------- | -------- |
| Default | `100`    |

This variable controls the total amount of breadcrumbs that should be captured. You should be aware that Sentry has a [maximum payload size](https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits) and any events exceeding that payload size will be dropped.

### [attachStacktrace](https://docs.sentry.io/platforms/javascript/configuration/options.md#attachStacktrace)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to exceptions; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all messages captured with `Sentry.captureMessage()`.

Grouping in Sentry is different for events with stack traces and without. As a result, you will get new groups as you enable or disable this flag for certain events.

### [sendDefaultPii](https://docs.sentry.io/platforms/javascript/configuration/options.md#sendDefaultPii)

| Type    | `boolean` |
| ------- | --------- |
| Default | `false`   |

If set to `true`, the SDK adds data that may identify the user, such as the user's IP address, to events. This option only controls a small set of data points. Use [`beforeSend`](https://docs.sentry.io/platforms/javascript/configuration/options.md#beforeSend) to control what's sent in more detail.

### [initialScope](https://docs.sentry.io/platforms/javascript/configuration/options.md#initialScope)

| Type | `CaptureContext` |
| ---- | ---------------- |

Data to be set to the initial scope. Initial scope can be defined either as an object or a callback function, as shown below.

```javascript
// Using an object
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  initialScope: {
    tags: { "my-tag": "my value" },
    user: { id: 42, email: "john.doe@example.com" },
  },
});

// Using a callback function
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  initialScope: (scope) => {
    scope.setTags({ a: "b" });
    return scope;
  },
});
```

### [maxValueLength](https://docs.sentry.io/platforms/javascript/configuration/options.md#maxValueLength)

| Type | `number` |
| ---- | -------- |

Maximum number of characters every string property on events sent to Sentry can have before it will be truncated.

### [normalizeDepth](https://docs.sentry.io/platforms/javascript/configuration/options.md#normalizeDepth)

| Type    | `number` |
| ------- | -------- |
| Default | `3`      |

Sentry SDKs normalize any contextual data to a given depth. Any data beyond this depth will be trimmed and marked using its type instead (`[Object]` or `[Array]`), without walking the tree any further. By default, walking is performed three levels deep.

### [normalizeMaxBreadth](https://docs.sentry.io/platforms/javascript/configuration/options.md#normalizeMaxBreadth)

| Type    | `number` |
| ------- | -------- |
| Default | `1000`   |

This is the maximum number of properties or entries that will be included in any given object or array when the SDK is normalizing contextual data. Any data beyond this depth will be dropped.

### [enabled](https://docs.sentry.io/platforms/javascript/configuration/options.md#enabled)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

Specifies whether this SDK should send events to Sentry. Setting this to `enabled: false` doesn't prevent all overhead from Sentry instrumentation. To disable Sentry completely, depending on environment, call `Sentry.init` conditionally.

### [sendClientReports](https://docs.sentry.io/platforms/javascript/configuration/options.md#sendClientReports)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

Set this option to `false` to disable sending of client reports. Client reports are a protocol feature that let clients send status reports about themselves to Sentry. They are currently mainly used to emit outcomes for events that were never sent.

### [integrations](https://docs.sentry.io/platforms/javascript/configuration/options.md#integrations)

| Type    | `Array<Integration> \| (integrations: Array<Integration>) => Array<Integration>` |
| ------- | -------------------------------------------------------------------------------- |
| Default | `[]`                                                                             |

Pass additional integrations that should be initialized with the SDK. Integrations are pieces of code that can be used to extend the SDK's functionality. They can be used to add custom event processors, context providers, or to hook into the SDK's lifecycle.

See [integration docs](https://docs.sentry.io/platforms/javascript/guides/cordova/configuration/integrations.md) for more information.

### [beforeBreadcrumb](https://docs.sentry.io/platforms/javascript/configuration/options.md#beforeBreadcrumb)

| Type | `(breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb \| null` |
| ---- | ----------------------------------------------------------------------- |

This function is called with a breadcrumb object before the breadcrumb is added to the scope. When nothing is returned from the function, the breadcrumb is dropped. To pass the breadcrumb through, return the first argument, which contains the breadcrumb object. The callback gets a second argument (called a "hint") which contains the original object from which the breadcrumb was created to further customize what the breadcrumb should look like.

### [transport](https://docs.sentry.io/platforms/javascript/configuration/options.md#transport)

| Type | `(transportOptions: TransportOptions) => Transport` |
| ---- | --------------------------------------------------- |

The SDK uses a transport to send events to Sentry. When the native SDK is enabled (see [`enableNative`](https://docs.sentry.io/platforms/javascript/configuration/options.md#enableNative)), the Cordova SDK sends events through the native layer, which also stores them while the device is offline. Otherwise, a `fetch`-based transport is used.

### [transportOptions](https://docs.sentry.io/platforms/javascript/configuration/options.md#transportOptions)

| Type | `TransportOptions` |
| ---- | ------------------ |

Options used to configure the transport. This is an object with the following possible optional keys:

* `headers`: An object containing headers to be sent with every request.
* `fetchOptions`: An object containing options to be passed to the `fetch` call. Used by the SDK's fetch transport.

## [Error Monitoring Options](https://docs.sentry.io/platforms/javascript/configuration/options.md#error-monitoring-options)

### [sampleRate](https://docs.sentry.io/platforms/javascript/configuration/options.md#sampleRate)

| Type    | `number` |
| ------- | -------- |
| Default | `1.0`    |

Configures the sample rate for error events, in the range of `0.0` to `1.0`. The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of error events will be sent. Events are picked randomly.

### [beforeSend](https://docs.sentry.io/platforms/javascript/configuration/options.md#beforeSend)

| Type | `(event: Event, hint: EventHint) => Event \| null` |
| ---- | -------------------------------------------------- |

This function is called with an SDK-specific message or error event object, and can return a modified event object, or `null` to skip reporting the event. This can be used, for instance, for manual PII stripping before sending.

By the time `beforeSend` is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect.

### [ignoreErrors](https://docs.sentry.io/platforms/javascript/configuration/options.md#ignoreErrors)

| Type    | `Array<string \| RegExp>` |
| ------- | ------------------------- |
| Default | `[]`                      |

A list of strings or regex patterns that match error messages that shouldn't be sent to Sentry. Messages that match these strings or regular expressions will be filtered out before they're sent to Sentry. When using strings, partial matches will be filtered out, so if you need to filter by exact match, use regex patterns instead. By default, all errors are sent.

### [denyUrls](https://docs.sentry.io/platforms/javascript/configuration/options.md#denyUrls)

| Type    | `Array<string \| RegExp>` |
| ------- | ------------------------- |
| Default | `[]`                      |

An array of strings or regex patterns that match the URLs of scripts where errors have been created. Errors that have been created on these URLs won't be sent to Sentry. If you use this option, errors will not be sent when the top stack frame file URL contains or matches at least one entry in the `denyUrls` array. All string entries in the array will be matched with `stackFrameUrl.contains(entry)`, while all RegEx entries will be matched with `stackFrameUrl.match(entry)`.

This option checks the source file URL in the stack trace, not the HTTP URL where the error was reported. For more fine grained filtering please refer to [beforeSend](https://docs.sentry.io/platforms/javascript/guides/react/configuration/options.md#beforeSend).

This matching logic applies to captured exceptions not raw message events. By default, all errors are sent.

### [allowUrls](https://docs.sentry.io/platforms/javascript/configuration/options.md#allowUrls)

| Type    | `Array<string \| RegExp>` |
| ------- | ------------------------- |
| Default | `[]`                      |

An array of strings or regex patterns that match the URLs of scripts where errors have been created. Only errors that have been created on these URLs will be sent to Sentry. If you use this option, errors will only be sent when the top stack frame file URL contains or matches at least one entry in the allowUrls array. All string entries in the array will be matched with `stackFrameUrl.contains(entry)`, while all RegEx entries will be matched with `stackFrameUrl.match(entry)`.

For example, if you add `'foo.com'` to the array, errors created on `https://bar.com/myfile/foo.com` will be captured because URL will be matched with "contains" logic and the last segment of the URL contains `foo.com`.

This matching logic applies for captured exceptions, not raw message events. By default, all errors are sent.

If your scripts are loaded from `cdn.example.com` and your site is `example.com`, you can set `allowUrls` to the following to exclusively capture errors being created in scripts in these locations:

```javascript
Sentry.init({
  allowUrls: [/https?:\/\/((cdn|www)\.)?example\.com/],
});
```

## [Tracing Options](https://docs.sentry.io/platforms/javascript/configuration/options.md#tracing-options)

### [tracesSampleRate](https://docs.sentry.io/platforms/javascript/configuration/options.md#tracesSampleRate)

| Type | `number` |
| ---- | -------- |

A number between `0` and `1`, controlling the percentage chance a given transaction will be sent to Sentry. (`0` represents 0% while `1` represents 100%.) Applies equally to all transactions created in the app. Either this or `tracesSampler` must be defined to enable tracing.

### [tracesSampler](https://docs.sentry.io/platforms/javascript/configuration/options.md#tracesSampler)

| Type | `(samplingContext: SamplingContext) => number \| boolean` |
| ---- | --------------------------------------------------------- |

A function responsible for determining the percentage chance a given transaction will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering transactions, by returning 0 for those that are unwanted. Either this or `tracesSampleRate` must be defined to enable tracing.

The `samplingContext` object passed to the function has the following properties:

* `transactionContext`: Information about the transaction, such as its `name` and `op`.
* `parentSampled`: The sampling decision of the parent transaction. This is `true` if the parent transaction was sampled, and `false` if it was not.
* `location`: The current `window.location`.

### [tracePropagationTargets](https://docs.sentry.io/platforms/javascript/configuration/options.md#tracePropagationTargets)

| Type    | `Array<string \| RegExp>`    |
| ------- | ---------------------------- |
| Default | `['localhost', /^\/(?!\/)/]` |

An optional property that controls which downstream services receive tracing data, in the form of a `sentry-trace` and a `baggage` header attached to any outgoing HTTP requests.

The option may contain a list of strings or regex against which the URLs of outgoing requests are matched. If one of the entries in the list matches the URL of an outgoing request, trace data will be attached to that request. String entries do not have to be full matches, meaning the URL of a request is matched when it *contains* a string provided through the option.

By default, trace data is attached to requests to `localhost` and to relative URLs (for example, `/api/users`).

If you want to disable trace propagation, you can set this option to `[]`.

### [beforeSendTransaction](https://docs.sentry.io/platforms/javascript/configuration/options.md#beforeSendTransaction)

| Type | `(event: TransactionEvent, hint: EventHint) => TransactionEvent \| null` |
| ---- | ------------------------------------------------------------------------ |

This callback receives a transaction event and an event hint after all event processors have run. Return the modified event to change its data, or `null` to drop the transaction and its child spans.

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  beforeSendTransaction(event) {
    // Don't send transactions for unimportant routes
    if (event.transaction === "/unimportant/route") {
      return null;
    }
    return event;
  },
});
```

### [ignoreTransactions](https://docs.sentry.io/platforms/javascript/configuration/options.md#ignoreTransactions)

| Type    | `Array<string \| RegExp>` |
| ------- | ------------------------- |
| Default | `[]`                      |

A list of strings or regex patterns that match transaction names that shouldn't be sent to Sentry. Strings match part of the name. Use a regular expression anchored with `^` and `$` for an exact match. A matching transaction and its child spans are dropped.

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  ignoreTransactions: ["partial/match", /^Exact Transaction Name$/],
});
```

## [Hybrid SDK Options](https://docs.sentry.io/platforms/javascript/configuration/options.md#hybrid-sdk-options)

### [enableNative](https://docs.sentry.io/platforms/javascript/configuration/options.md#enableNative)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

Set this option to `false` to disable the native SDK. This will disable all native crash and error handling and, instead, the SDK will only capture errors on the upper layer.

### [enableAutoSessionTracking](https://docs.sentry.io/platforms/javascript/configuration/options.md#enableAutoSessionTracking)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

Set this option to `false` to disable the [release health](https://docs.sentry.io/product/releases/health.md) feature.

### [sessionTrackingIntervalMillis](https://docs.sentry.io/platforms/javascript/configuration/options.md#sessionTrackingIntervalMillis)

| Type    | `number` |
| ------- | -------- |
| Default | `30000`  |

Set this to change the default interval to end a session (release health) if the app goes to the background. Default is 30,000.

### [enableNdkScopeSync](https://docs.sentry.io/platforms/javascript/configuration/options.md#enableNdkScopeSync)

| Type    | `boolean` |
| ------- | --------- |
| Default | `false`   |

Set this option to `true` to enable the scope sync from Java to NDK on Android.

### [attachThreads](https://docs.sentry.io/platforms/javascript/configuration/options.md#attachThreads)

| Type    | `boolean` |
| ------- | --------- |
| Default | `false`   |

Set this option to `true` to automatically attach all threads to all logged events on Android.

### [enableOutOfMemoryTracking](https://docs.sentry.io/platforms/javascript/configuration/options.md#enableOutOfMemoryTracking)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

Set this option to `false` to disable [out of memory](https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory.md) tracking on iOS.

### [enableAppHangTracking](https://docs.sentry.io/platforms/javascript/configuration/options.md#enableAppHangTracking)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

Set this option to `false` to disable [app hang](https://docs.sentry.io/platforms/apple/guides/ios/configuration/app-hangs.md) tracking on iOS. The SDK reports an app hang when the app is unresponsive for longer than `appHangTimeoutInterval`.

### [appHangTimeoutInterval](https://docs.sentry.io/platforms/javascript/configuration/options.md#appHangTimeoutInterval)

| Type    | `number` |
| ------- | -------- |
| Default | `2`      |

The minimum amount of time, in seconds, that the app needs to be unresponsive to be reported as an app hang on iOS. Avoid values lower than `0.1`, which may cause a lot of app hang events.

### [enableNativeNagger](https://docs.sentry.io/platforms/javascript/configuration/options.md#enableNativeNagger)

| Type    | `boolean` |
| ------- | --------- |
| Default | `true`    |

Set this option to `false` to disable the native nagger alert being shown.
