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
5 changes: 4 additions & 1 deletion docs/platforms/dart/user-feedback/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ When a user experiences an error, Sentry provides the ability to collect additio

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.
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. There are several ways to get the `eventId`:
- use {<PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink>}
- use the return value of any method capturing an event.
- use `Sentry.lastEventId` to get the ID of the last event sent.

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

Expand Down
5 changes: 4 additions & 1 deletion docs/platforms/flutter/user-feedback/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ When a user experiences an error, Sentry provides the ability to collect additio

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.
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. There are several ways to get the `eventId`:
- use {<PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink>}
- use the return value of any method capturing an event.
- use `Sentry.lastEventId` to get the ID of the last event sent.

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

Expand Down
14 changes: 14 additions & 0 deletions platform-includes/user-feedback/sdk-api-example/dart.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
```dart
import 'package:sentry/sentry.dart';

// Option 1: Retrieving SentryId from beforeSend
SentryId sentryId = SentryId.empty();

await Sentry.init((options) {
options.beforeSend = (event, {hint}) async {
sentryId = event.eventId;
return event;
};
});

// Option 2: Retrieving SentryId from the method capturing the event
SentryId sentryId = Sentry.captureMessage("My message");

// Option 3: Retrieving SentryId from the beforeSend callback
SentryId sentryId = Sentry.lastEventId;

final userFeedback = SentryUserFeedback(
eventId: sentryId,
comments: 'Hello World!',
Expand Down