From a273160cb8c7a21c5201cfcf6d32ef1616878485 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:11:13 -0800 Subject: [PATCH 1/3] ref(feedback): update JS SDK API example --- .../javascript/common/user-feedback/index.mdx | 8 ++++---- .../sdk-api-example/javascript.mdx | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/docs/platforms/javascript/common/user-feedback/index.mdx b/docs/platforms/javascript/common/user-feedback/index.mdx index e1e18b0dfe6fe0..07c6034e723d69 100644 --- a/docs/platforms/javascript/common/user-feedback/index.mdx +++ b/docs/platforms/javascript/common/user-feedback/index.mdx @@ -22,7 +22,7 @@ The embeddable JavaScript widget allows users to submit feedback from anywhere i ### Installation - + fdf ### Set Up @@ -51,12 +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 Our embeddable, JavaScript-based, Crash-Report modal is useful when you would typically render a plain error page (the classic `500.html`) on your website. diff --git a/platform-includes/user-feedback/sdk-api-example/javascript.mdx b/platform-includes/user-feedback/sdk-api-example/javascript.mdx index 7fe8ab66c98efc..aced1ec6e70bcc 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 w/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", From bddc0bade8057dc4ebc5de821dda64944e1c409f Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:18:27 -0800 Subject: [PATCH 2/3] Rm fdf --- docs/platforms/javascript/common/user-feedback/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/user-feedback/index.mdx b/docs/platforms/javascript/common/user-feedback/index.mdx index 07c6034e723d69..c69d37f3f62db7 100644 --- a/docs/platforms/javascript/common/user-feedback/index.mdx +++ b/docs/platforms/javascript/common/user-feedback/index.mdx @@ -22,7 +22,7 @@ The embeddable JavaScript widget allows users to submit feedback from anywhere i ### Installation - fdf + ### Set Up From faf8bdfe7bf96dcb782c5ea0a7828c0751ab0f50 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:27:04 -0800 Subject: [PATCH 3/3] Review comments --- docs/platforms/javascript/common/user-feedback/index.mdx | 3 ++- platform-includes/user-feedback/sdk-api-example/javascript.mdx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/platforms/javascript/common/user-feedback/index.mdx b/docs/platforms/javascript/common/user-feedback/index.mdx index c69d37f3f62db7..8e993fe5f929cf 100644 --- a/docs/platforms/javascript/common/user-feedback/index.mdx +++ b/docs/platforms/javascript/common/user-feedback/index.mdx @@ -53,7 +53,8 @@ The user feedback API allows you to collect user feedback while utilizing your o 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()`. +2. Use {' '}and `Sentry.lastEventId()`. + diff --git a/platform-includes/user-feedback/sdk-api-example/javascript.mdx b/platform-includes/user-feedback/sdk-api-example/javascript.mdx index aced1ec6e70bcc..a7717c6de83ffb 100644 --- a/platform-includes/user-feedback/sdk-api-example/javascript.mdx +++ b/platform-includes/user-feedback/sdk-api-example/javascript.mdx @@ -10,7 +10,7 @@ const userFeedback = { Sentry.captureFeedback(userFeedback); ``` -```javascript {tabTitle: JavaScript w/eventId} +```javascript {tabTitle: JavaScript with eventId} import * as Sentry from "@sentry/browser"; const eventId = Sentry.captureException(new Error("Something went wrong!"));