Configuration

Learn about general User Feedback configuration fields.

Because the feedbackIntegration is a user-facing integration, we offer two loading strategies that have bundle size implications.

For most users, we recommend using feedbackIntegration in your Sentry.init call. This will set up user feedback with good defaults, matching the environment.

All of the code examples on this page use feedbackIntegration as a default because it's available regardless of whether you've chosen the CDN or NPM installation method. However, the implementation of feedbackIntegration is different for the two installation methods. For NPM users, feedbackIntegration is an alias of feedbackSyncIntegration. For CDN users, feedbackIntegration is an alias of feedbackAsyncIntegration.

If you've installed the SDK with NPM, this loading strategy is used by default. The strategy isn't available if you've installed the SDK via the CDN.

This integration includes all the code needed to render the "Send Feedback" button, as well as the form that is triggered when the button is clicked. Choosing this loading strategy means accepting the largest upfront bundle size in your application. The benefit of this is that the feedback widget is guaranteed to open when the user interacts with it, but in either case, network connectivity is required to send the feedback message.

If you installed the SDK with the CDN, this loading strategy is used by default. If you used NPM, you can still choose to use this loading strategy by adding this integration to your Sentry.init call.

This integration includes the minimum amount of code needed upfront to show the "Send Feedback" button on the screen when the page is loaded. When the user clicks on that button, the integration will asynchronously load internal integrations from https://browser.sentry-cdn.com that show the form and let the user type out their feedback message. This has the benefit of being the smallest bundle size. The drawback is that asynchronous loading can fail if, for example, the user has an ad-blocker.

For CDN users feedbackIntegration is an alias of feedbackAsyncIntegration.

Copied
import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  integrations: [
    // Use the default strategy, an alias for `feedbackAsyncIntegration`
    Sentry.feedbackIntegration({
      // Additional SDK configuration goes in here, for example:
      colorScheme: "system",
    }),
  ],
});

For NPM users feedbackIntegration is an alias of feedbackSyncIntegration.

Copied
import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  integrations: [
    // Use the default strategy, an alias for `feedbackSyncIntegration`
    Sentry.feedbackIntegration({
      // Additional SDK configuration goes in here, for example:
      colorScheme: "system",
    }),
  ],
});

You can customize the Crash-Report modal to your organization's needs, for example, for localization purposes. All options can be passed through the Sentry.showReportDialog call.

ParamDefault
eventIdManually set the id of the event.
dsnManually set dsn to report to.
userManually set user data [an object with keys listed below].
user.emailUser's email address.
user.nameUser's name.
lang[automatic] – (Override for Sentry’s language code.)
titleIt looks like we’re having issues.
subtitleOur team has been notified.
subtitle2If you’d like to help, tell us what happened below. – (Not visible on small screen resolutions.)
labelNameName
labelEmailEmail
labelCommentsWhat happened?
labelCloseClose
labelSubmitSubmit
errorGenericAn unknown error occurred while submitting your report. Please try again.
errorFormEntrySome fields were invalid. Please correct the errors and try again.
successMessageYour feedback has been sent. Thank you!
onLoadn/a - (An optional callback that will be invoked when the widget opens.)
onClosen/a - (An optional callback that will be invoked when the widget closes.)

The optional callback onLoad will be called when users see the widget. You can use this to run custom logic, for example to log an analytics event:

Copied
Sentry.showReportDialog({
  // ...
  onLoad() {
    // Log an event to amplitude when the report dialog opens
    amplitude.logEvent("report_dialog_seen");
  },
});

The optional callback onClose will be called when users close the widget. You can use this to run custom logic, for example to reload the page:

Requires JS SDK version v7.82.0 or higher.

Copied
Sentry.showReportDialog({
  // ...
  onClose() {
    // Refresh the page after the user closes the report dialog
    location.reload();
  },
});
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").