From 4838811b664ebf09703769992cea114faa9ca43a Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Fri, 18 Dec 2020 12:44:53 +0100 Subject: [PATCH 1/5] feat: Document the User Feedback API Add more context on how to implement the user feedback API on user facing platforms. Fixes GH-218 --- src/docs/sdk/features.mdx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index 929d80649d..74285855f6 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -75,9 +75,22 @@ Ability to get the ID of the last event sent. Event IDs are useful for correlati ## User Feedback -On user-facing platforms such as mobile or the browser this means first class support for requesting user feedback when an error occurs. +For all SDKs, it is strongly recommended to send the user feedback as an [envelope](/sdk/envelopes/#user-feedback). Alternatively, the SDKs can +use the [user feedback endpoint](https://docs.sentry.io/api/projects/submit-user-feedback/), which is not recommended. -On backend platforms, SDKs should document how to use the last event ID to prompt the user for feedback themselves. +### User Facing Platforms +On user-facing platforms such as mobile, desktop, or browser this means first-class support for requesting user feedback when an error or crash occurs. +To see some examples of the API check out the user-facing docs for [Apple](https://docs.sentry.io/platforms/apple/enriching-events/user-feedback/) and +[Java](https://docs.sentry.io/platforms/java/enriching-events/user-feedback/). + +On mobile and desktop, it is common to prompt the user for feedback after a crash happened on the previous run of the application. Therefore the SDKs should +implement the `onCrashedLastRun` callback on the options. This callback gets called shortly after the initialization of the SDK when the last program execution +terminated with a crash. The SDK should execute the callback only once during the entire run of the program to avoid multiple callbacks if there are multiple +crash events to send. + +### Backend Platforms + +On backend platforms, SDKs should document how to use the last event ID to prompt the user for feedback themselves. ## Before-Send Hook From 3feaacce7a66dfd482484c9e12533432f245693c Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 21 Dec 2020 10:59:37 +0100 Subject: [PATCH 2/5] Add example implementations Co-authored-by: Bruno Garcia --- src/docs/sdk/features.mdx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index 74285855f6..d56a47df43 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -92,6 +92,20 @@ crash events to send. On backend platforms, SDKs should document how to use the last event ID to prompt the user for feedback themselves. +### Example implementations + +User Feedback class: + * [Objective-C](https://github.com/getsentry/sentry-cocoa/blob/9eedc425727f0daccca1bd2be6021f6c3d9c654c/Sources/Sentry/SentryUserFeedback.m) + * [Java](https://github.com/getsentry/sentry-java/blob/671f9e0b8b709ef18e8b0788c31df44f99d09d35/sentry/src/main/java/io/sentry/UserFeedback.java#L7) + * [C#](https://github.com/getsentry/sentry-dotnet/blob/6ddf8363170bffee74a8c3cbf44335797d39ca9c/src/Sentry/Protocol/UserFeedback.cs#L10) + +Envelope item: + + * [Objective-C](https://github.com/getsentry/sentry-cocoa/blob/fd3e46efe59324e894d5601a7b3028824a588dda/Sources/Sentry/SentryEnvelope.m#L145-L162) + * [Java](https://github.com/getsentry/sentry-java/blob/b2e8dd43ea2ef37201b215ec409655e49e3231c8/sentry/src/main/java/io/sentry/SentryEnvelopeItem.java#L131-L155) + * [C#](https://github.com/getsentry/sentry-dotnet/blob/3bc6c66a14e653982a6a25df033d68d8ad12c4af/src/Sentry/Protocol/Envelopes/EnvelopeItem.cs#L170-L178) + + ## Before-Send Hook Hook called with the event (and on some platforms the hint) that allow the user to decide whether an event should be sent or not. This can also be used to further modify the event. From 80e98c8ae45299ffdd4f2a411323bcc8716c4a33 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 21 Dec 2020 14:11:24 +0100 Subject: [PATCH 3/5] Update src/docs/sdk/features.mdx Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> --- src/docs/sdk/features.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index d56a47df43..c67a61f613 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -75,8 +75,8 @@ Ability to get the ID of the last event sent. Event IDs are useful for correlati ## User Feedback -For all SDKs, it is strongly recommended to send the user feedback as an [envelope](/sdk/envelopes/#user-feedback). Alternatively, the SDKs can -use the [user feedback endpoint](https://docs.sentry.io/api/projects/submit-user-feedback/), which is not recommended. +For all SDKs, it is strongly recommended to send the `User Feedback` as an [envelope](/sdk/envelopes/#user-feedback). Alternatively, the SDKs can +use the [User Feedback endpoint](https://docs.sentry.io/api/projects/submit-user-feedback/), which is not recommended. ### User Facing Platforms On user-facing platforms such as mobile, desktop, or browser this means first-class support for requesting user feedback when an error or crash occurs. From 69a7f45e5ecf8c5414eb3ba6348f2dc5b680d17d Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 21 Dec 2020 14:11:30 +0100 Subject: [PATCH 4/5] Update src/docs/sdk/features.mdx Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> --- src/docs/sdk/features.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index c67a61f613..1fb052b534 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -79,7 +79,7 @@ For all SDKs, it is strongly recommended to send the `User Feedback` as an [enve use the [User Feedback endpoint](https://docs.sentry.io/api/projects/submit-user-feedback/), which is not recommended. ### User Facing Platforms -On user-facing platforms such as mobile, desktop, or browser this means first-class support for requesting user feedback when an error or crash occurs. +On user-facing platforms such as mobile, desktop, or browser this means first-class support for requesting User Feedback when an error or crash occurs. To see some examples of the API check out the user-facing docs for [Apple](https://docs.sentry.io/platforms/apple/enriching-events/user-feedback/) and [Java](https://docs.sentry.io/platforms/java/enriching-events/user-feedback/). From 26649322144ef5614f9a809111256963cbfda429 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 21 Dec 2020 14:18:32 +0100 Subject: [PATCH 5/5] Add link to last event id --- src/docs/sdk/features.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs/sdk/features.mdx b/src/docs/sdk/features.mdx index 1fb052b534..7328fa1c76 100644 --- a/src/docs/sdk/features.mdx +++ b/src/docs/sdk/features.mdx @@ -90,7 +90,7 @@ crash events to send. ### Backend Platforms -On backend platforms, SDKs should document how to use the last event ID to prompt the user for feedback themselves. +On backend platforms, SDKs should document how to use the [last event ID](#retrieve-last-event-id) to prompt the user for feedback themselves. ### Example implementations