Extended Configuration Integrations for Cordova

Learn more about how integrations extend the functionality of our SDK to cover common libraries and environments automatically.

The Sentry SDK uses integrations to hook into the functionality of popular libraries to automatically instrument your application and give you the best data out of the box.

Integrations automatically add error instrumentation, performance instrumentation, and/or extra context information to your application. Some are enabled by default, but you can remove them or modify their settings.

The Cordova SDK is based on version 7 of the Sentry JavaScript SDK. It exposes the default browser integrations as classes on Sentry.BrowserIntegrations.

ErrorsAdditional Context
Breadcrumbs✓
Dedupe✓
FunctionToString
GlobalHandlers✓
HttpContext✓
InboundFilters✓
LinkedErrors✓
TryCatch✓

To override the settings of a default integration, provide a new instance with your config to the integrations option. It replaces the default instance with the same name.

For example, to stop capturing click and keypress events as breadcrumbs:

Copied
Sentry.init({
  dsn: "___PUBLIC_DSN___",
integrations: [ new Sentry.BrowserIntegrations.Breadcrumbs({ dom: false, }), ],
});

To remove one or more of the default integrations, pass a function to the integrations option and filter out the ones you don't want. The Cordova SDK always sets up its default integrations, so the defaultIntegrations: false option has no effect.

This example removes the integration for adding breadcrumbs to the event, which is enabled by default:

Copied
Sentry.init({
  // ...
  integrations: function (integrations) {
    // integrations will be all default integrations
    return integrations.filter(function (integration) {
      return integration.name !== "Breadcrumbs";
    });
  },
});

You can add additional integrations in your init call. For example, to enable tracing:

Copied
Sentry.init({
  dsn: "___PUBLIC_DSN___",
  integrations: [Sentry.browserTracingIntegration()],
});

You can also create custom integrations.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").