Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/platforms/javascript/common/user-feedback/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ The User Feedback widget integrates easily with <PlatformLink to="/session-repla

The user feedback API allows you to collect user feedback while utilizing your own UI. You can use the same programming language you have in your app to send user feedback. In this case, the SDK creates the HTTP request so you don't have to deal with posting data via HTTP.

Sentry pairs the feedback with the original event, giving you additional insight into issues. Sentry needs the `eventId` to be able to associate the user feedback to the corresponding event. For example, to get the `eventId`, you can use <PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink> or the return value of the method capturing an event.
You can optionally pass in an `associatedEventId` to associate user feedback with an error event, giving you additional insight into issues. To get an event ID, you have 2 options:
1. Use the return value of a method capturing an event.
2. Use <PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink>{' '}and `Sentry.lastEventId()`.

<PlatformContent includePath="user-feedback/sdk-api-example/" />

Alternatively, you can use the [User Feedback API endpoint](/api/projects/submit-user-feedback/) directly.
<PlatformContent includePath="user-feedback/sdk-api-example/" />

## Crash-Report Modal

Expand Down
17 changes: 15 additions & 2 deletions platform-includes/user-feedback/sdk-api-example/javascript.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
```javascript
```javascript {tabTitle: JavaScript}
import * as Sentry from "@sentry/browser";

// All feedback fields are optional, except `message`.
const userFeedback = {
name: "John Doe",
email: "[email protected]",
message: "I really like your App, thanks!",
};
Sentry.captureFeedback(userFeedback);
```

```javascript {tabTitle: JavaScript with eventId}
import * as Sentry from "@sentry/browser";

const eventId = Sentry.captureMessage("User Feedback");
const eventId = Sentry.captureException(new Error("Something went wrong!"));
// OR: const eventId = Sentry.lastEventId();

// All feedback fields are optional, except `message`.
const userFeedback = {
name: "John Doe",
email: "[email protected]",
Expand Down
Loading