Skip to main content

[JavaScript] How do I use User Feedback with the Loader Script?

Issue

I use the JavaScript Loader Script and I called feedbackIntegration(). The User Feedback widget does not appear. The browser console shows You are using feedbackIntegration() even though this bundle does not include feedback.

Applies To

  • All SaaS Customers and Self-Hosted Users

  • JavaScript Loader Script

  • User Feedback

  • SDK Setup

Resolution

The default Loader Script bundle does not include User Feedback. There is no User Feedback toggle in Project Settings for the Loader Script. Lazy-load feedbackIntegration with Sentry.lazyLoadIntegration (Loader v8 and later).

Define window.sentryOnLoad before the Loader Script tag. Call Sentry.init, then lazy-load and add the integration:

window.sentryOnLoad = function () {
  Sentry.init({
    // add other configuration here
  });  Sentry.lazyLoadIntegration("feedbackIntegration")
    .then((feedbackIntegration) => {
      Sentry.addIntegration(
        feedbackIntegration({
          // User Feedback configuration options
        }),
      );
    })
    .catch(() => {
      // this can happen if e.g. a network error occurs,
      // in this case User Feedback will not be enabled
    });
};

If the promise rejects:

lazyLoadIntegration fails when a network error or ad blocker blocks the Sentry CDN. User Feedback stays disabled. Handle the rejection, then install with npm or a CDN bundle that includes feedback.

If you are not using the Loader Script:

Add feedbackIntegration in Sentry.init. See Set Up User Feedback.

If you self-host Sentry:

The User Feedback widget needs self-hosted version 24.4.2 or higher.

For the same lazy-load pattern with other integrations, see [JavaScript] Why are my integrations not working with the Loader Script?.

Did this answer your question?