diff --git a/docs/platforms/javascript/common/user-feedback/index.mdx b/docs/platforms/javascript/common/user-feedback/index.mdx index e1e18b0dfe6fe..8e993fe5f929c 100644 --- a/docs/platforms/javascript/common/user-feedback/index.mdx +++ b/docs/platforms/javascript/common/user-feedback/index.mdx @@ -51,11 +51,12 @@ The User Feedback widget integrates easily with 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 {' '}and `Sentry.lastEventId()`. - -Alternatively, you can use the [User Feedback API endpoint](/api/projects/submit-user-feedback/) directly. + ## Crash-Report Modal diff --git a/platform-includes/user-feedback/sdk-api-example/javascript.mdx b/platform-includes/user-feedback/sdk-api-example/javascript.mdx index 7fe8ab66c98ef..a7717c6de83ff 100644 --- a/platform-includes/user-feedback/sdk-api-example/javascript.mdx +++ b/platform-includes/user-feedback/sdk-api-example/javascript.mdx @@ -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: "john@doe.com", + 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: "john@doe.com",