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
24 changes: 24 additions & 0 deletions src/includes/user-feedback/example-widget/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Make sure you've got the JavaScript SDK available:

```html
<script
src="https://browser.sentry-cdn.com/{{ packages.version('sentry.javascript.browser') }}/bundle.min.js"
integrity="sha384-{{ packages.checksum('sentry.javascript.browser', 'bundle.min.js', 'sha384-base64') }}"
crossorigin="anonymous"
></script>
```

You'll then need to call `showReportDialog` and pass in the generated event ID.
This event ID is returned from all calls to <PlatformIdentifier
name="capture-event" /> and <PlatformIdentifier name="capture-exception" />.
There is also a function called <PlatformIdentifier name="last-event-id" />
that returns the ID of the most recently sent event.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a note that for users using ASP.NET or ASP.NET Core, there's a specific content for this?
We have overrides for this on those that include a proper snippet:

https://docs.sentry.io/platforms/dotnet/guides/aspnet/enriching-events/user-feedback/#integration

https://docs.sentry.io/platforms/dotnet/guides/aspnetcore/enriching-events/user-feedback/#integration

I'm just afraid folks land on .NET and click on User Feedback on the left without understanding that there's a "better" content if they are in fact using a web technology.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that in here: https://sentry-docs-kl81mjezf.sentry.dev/platforms/dotnet/enriching-events/user-feedback/

There's no indication that this snippet:
image

Is not what you need if you're on ASP.NET or ASP.NET Core (90% of all Web Apps in .NET fall into one of these two)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, got it. Yes, we can do that.

```html
<script>
Sentry.init({ dsn: "___PUBLIC_DSN___" });
Sentry.showReportDialog({
eventId: "{{ event_id }}",
});
</script>
```
26 changes: 26 additions & 0 deletions src/includes/user-feedback/sdk-api-example/android.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```java
import io.sentry.Sentry;
import io.sentry.UserFeedback;

SentryId sentryId = Sentry.captureMessage("My message");

UserFeedback userFeedback = new UserFeedback(sentryId);
userFeedback.setComments("It broke.");
userFeedback.setEmail("[email protected]");
userFeedback.setName("John Doe");
Sentry.captureUserFeedback(userFeedback);
```

```kotlin
import io.sentry.Sentry
import io.sentry.UserFeedback

val sentryId = Sentry.captureMessage("My message")

val userFeedback = UserFeedback(sentryId).apply {
comments = "It broke."
email = "[email protected]"
name = "John Doe"
}
Sentry.captureUserFeedback(userFeedback)
```
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
---
title: "User Feedback"
sidebar_order: 105

description: "Learn more about the user feedback API, which provides the ability to collect user information when an event occurs. Sentry pairs the feedback with the original event, giving you additional insight into issues."
---

The user feedback API provides the ability to collect user information when an event occurs. 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. To get the `eventId`, for example, you can use the <PlatformLink to="/configuration/options/#before-send">beforeSend</PlatformLink> or the return value of the methods capturing an event.

```swift {tabTitle:Swift}
import Sentry

Expand Down
26 changes: 26 additions & 0 deletions src/includes/user-feedback/sdk-api-example/java.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```java
import io.sentry.Sentry;
import io.sentry.UserFeedback;

SentryId sentryId = Sentry.captureMessage("My message");

UserFeedback userFeedback = new UserFeedback(sentryId);
userFeedback.setComments("It broke.");
userFeedback.setEmail("[email protected]");
userFeedback.setName("John Doe");
Sentry.captureUserFeedback(userFeedback);
```

```kotlin {tabTitle:Kotlin}
import io.sentry.Sentry
import io.sentry.UserFeedback

val sentryId = Sentry.captureMessage("My message")

val userFeedback = UserFeedback(sentryId).apply {
comments = "It broke."
email = "[email protected]"
name = "John Doe"
}
Sentry.captureUserFeedback(userFeedback)
```
36 changes: 0 additions & 36 deletions src/platforms/android/common/enriching-events/user-feedback.mdx

This file was deleted.

73 changes: 59 additions & 14 deletions src/platforms/common/enriching-events/user-feedback.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,75 @@ title: "User Feedback"
sidebar_order: 105
redirect_from:
- /learn/user-feedback/
description: "Learn more about the embeddable JavaScript widget, which requests and collects the user information when an event occurs. Sentry pairs the feedback with the original event, giving you additional insight into issues."
description: "Learn more about collecting user feedback when an event occurs. Sentry pairs the feedback with the original event, giving you additional insight into issues."
notSupported:
- android
- apple
- native
- native.breakpad
- native.crashpad
- native.minidumps
- native.wasm
- native.ue4
- dart
- flutter
- ruby
---

When a user experiences an error, Sentry provides the ability to collect additional feedback. This type of feedback is useful when you may typically render a plain error page (the classic `500.html`).
When a user experiences an error, Sentry provides the ability to collect additional feedback. You can collect feedback according to the method supported by the SDK.

To collect feedback, use the embeddable JavaScript widget, which requests and collects the user's name, email address, and a description of what occurred. When feedback is provided, Sentry pairs the feedback with the original event, giving you additional insights into issues.
<PlatformSection supported={["java", "apple", "android"]} >

## User Feedback API

The user feedback API provides the ability to collect user information when an event occurs. You can use the same programming languge 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. To get the `eventId`, for example, you can use the <PlatformLink to="/configuration/options/#before-send">beforeSend</PlatformLink> or the return value of the methods capturing an event.

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

</PlatformSection>

<PlatformSection supported={["dotnet"]}>

## Use the .NET SDK

<Note>

User Feedback for **[ASP.NET](/platforms/dotnet/guides/aspnet/enriching-events/user-feedback/#integration)** or **[ASP.NET Core](/platforms/dotnet/guides/aspnetcore/enriching-events/user-feedback/#integration)** supply integrations specific to supporting those SDKs.

</Note>

You can create a form to collect the user input in your prefered framework, and use the SDK's API to send the information to Sentry. You can also use the widget, as described below. If you'd prefer an alternative to the widget or do not have a JavaScript frontend, you can use this API or a [Web API](/api/projects/submit-user-feedback/).

```csharp {tabTitle:C#}
using Sentry;

var eventId = SentrySdk.CaptureMessage("An event that will receive user feedback.");

SentrySdk.CaptureUserFeedback(eventId, "[email protected]", "It broke.", "The User");
```

```fsharp {tabTitle:F#}
open Sentry

let eventId = SentrySdk.CaptureMessage("An event that will receive user feedback.")

SentrySdk.CaptureUserFeedback(eventId, "[email protected]", "It broke.", "The User")
```

</PlatformSection>

<PlatformSection notSupported={["android", "apple", "java", "native", "dart", "flutter", "ruby"]}>

## Embeddable JavaScript Widget

Our embeddable JavaScript widget is useful when you may typically render a plain error page (the classic `500.html`) on your website.

To collect feedback, the widget requests and collects the user's name, email address, and a description of what occurred. When feedback is provided, Sentry pairs the feedback with the original event, giving you additional insights into issues.

The screenshot below provides an example of the User Feedback widget, though yours may differ depending on your customization:

![An example of a user feedback widget with text boxes for user name, email, and additional details about the break.](user_feedback_widget.png)

## Collecting Feedback
### Integration

To integrate the widget, you'll need to be running version 2.1 or newer of our JavaScript SDK. The widget authenticates with your public DSN, then passes in the Event ID that was generated on your backend.

**If you'd prefer an alternative to the widget or do not have a JavaScript frontend, you can use the [User Feedback API](https://docs.sentry.io/api/projects/post-project-user-reports/).**

<PlatformContent includePath="user-feedback-example-widget" />
<PlatformContent includePath="user-feedback/example-widget" />

## Customizing the Widget

Expand Down Expand Up @@ -60,3 +99,9 @@ An override for Sentry’s automatic language detection (e.g. `lang=de`)
| `errorFormEntry` | Some fields were invalid. Please correct the errors and try again. |
| `successMessage` | Your feedback has been sent. Thank you! |
| `onLoad` | n/a |

## User Feedback API

If you'd prefer an alternative to the widget or do not have a JavaScript frontend, you can use the [User Feedback API](/api/projects/submit-user-feedback/).

</PlatformSection>
70 changes: 0 additions & 70 deletions src/platforms/dotnet/common/enriching-events/user-feedback.mdx

This file was deleted.

Binary file not shown.
36 changes: 0 additions & 36 deletions src/platforms/java/common/enriching-events/user-feedback.mdx

This file was deleted.