Skip to content

Commit a7e881f

Browse files
committed
fix(js): Fix feedback for using feedback with the Loader
Closes #12138
1 parent 4357e8c commit a7e881f

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

platform-includes/user-feedback/install/javascript.mdx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
1-
The User Feedback integration is **already included** in your browser or framework SDK NPM packages. If you're using CDN bundles instead of NPM packages, you need to load the User Feedback integration CDN bundle in addition to your browser bundle:
1+
The User Feedback integration is **already included** in your NPM packages. You can enable it by adding it to your `integrations` in your `init` config:
22

3-
```bash {tabTitle:npm}
4-
npm install @sentry/browser --save
5-
```
3+
```javascript {tabTitle: NPM}
4+
import * as Sentry from "@sentry/browser";
65

7-
```bash {tabTitle:yarn}
8-
yarn add @sentry/browser
6+
Sentry.init({
7+
dsn: "___DSN___",
8+
integrations: [Sentry.feedbackIntegration()],
9+
});
910
```
1011

11-
```bash {tabTitle:pnpm}
12-
pnpm add @sentry/browser
12+
If you're using the Loader Script, you can lazy load the User Feedback integration like this:
13+
14+
```javascript {tabTitle: Loader}
15+
window.sentryOnLoad = function () {
16+
Sentry.init({
17+
// add other configuration here
18+
});
19+
20+
Sentry.lazyLoadIntegration("feedbackIntegration")
21+
.then((feedbackIntegration) => {
22+
Sentry.addIntegration(feedbackIntegration());
23+
})
24+
.catch(() => {
25+
// this can happen if e.g. a network error occurs,
26+
// in this case User Feedback will not be enabled
27+
});
28+
};
1329
```
1430

31+
If you're using CDN bundles instead of NPM packages, you need to load the User Feedback integration CDN bundle in addition to your browser bundle:
32+
1533
```html {tabTitle: CDN}
1634
<!-- Recommended: Use this bundle for feedback, replay, error, and tracing -->
1735
<script

0 commit comments

Comments
 (0)