Skip to content
Open
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
47 changes: 47 additions & 0 deletions docs/platforms/godot/configuration/filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,50 @@ All Sentry SDKs support the <PlatformIdentifier name="before-send" /> callback m
<PlatformContent includePath="configuration/before-send/" />

Note also that breadcrumbs can be filtered, as discussed in [our Breadcrumbs documentation](/product/issues/issue-details/breadcrumbs/).

## Filtering User Feedback

<AvailableSince version="2.2.0" />

User feedback doesn't pass through <PlatformIdentifier name="before-send" />, so that callback can't filter or modify feedback submissions. Use <PlatformIdentifier name="before-send-feedback" /> instead.

### Using <PlatformIdentifier name="before-send-feedback" />

The <PlatformIdentifier name="before-send-feedback" /> callback receives a prepared `SentryEvent` after scope data and event enrichment have been applied. Return the same event object, with or without modifications, to send the feedback, or return `null` to drop it.

You can only set this callback [programmatically](/platforms/godot/configuration/options/#programmatic-configuration). Disable **Auto Init**, then assign the callback when initializing the SDK:

```gdscript {tabTitle:GDScript} {mdExpandTabs}
SentrySDK.init(func(options: SentryOptions) -> void:
options.before_send_feedback = _before_send_feedback
)

func _before_send_feedback(event: SentryEvent) -> SentryEvent:
if event.environment == "editor_dev_run":
return null
event.set_tag("feedback_source", "in_game_form")
return event
```

```csharp {tabTitle:C#}
SentrySdk.Init(options =>
{
options.SetBeforeSendFeedback(feedbackEvent =>
{
if (feedbackEvent.Environment == "editor_dev_run")
{
return null;
}
feedbackEvent.SetTag("feedback_source", "in_game_form");
return feedbackEvent;
});
});
```

In C#, `SetBeforeSendFeedback` applies to feedback captured through the managed `SentrySdk.CaptureFeedback` API. Feedback captured through GDScript or the native Godot API uses `before_send_feedback` instead.

<Alert level="warning" title="iOS and macOS">

In GDScript, the `before_send_feedback` callback isn't supported on iOS or macOS yet. Feedback is still sent on these platforms, but the callback doesn't run. This limitation doesn't apply to the C# callback.

</Alert>
8 changes: 8 additions & 0 deletions docs/platforms/godot/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,14 @@ In C#, `options.SetBeforeSend` covers managed events only. To filter native even

</SdkOption>

<SdkOption name="before_send_feedback" type="Callable" availableSince="2.2.0">

Feedback events don't pass through [`before_send`](#before_send). Use this callback to inspect, modify, or drop user feedback before the SDK sends it to Sentry. You can only set it [programmatically](#programmatic-configuration).

The submitted message, name, contact email, and associated event ID are included in the event's `feedback` context. See <PlatformLink to="/configuration/filtering/#filtering-user-feedback">Filtering User Feedback</PlatformLink> for callback behavior, setup, and platform support.

</SdkOption>

<SdkOption name="before_capture_screenshot" type="Callable">

If assigned, this callback runs before a screenshot is captured. You can only set it [programmatically](#programmatic-configuration). It takes `SentryEvent` as a parameter and returns `false` to skip capturing the screenshot, or `true` to capture the screenshot.
Expand Down
23 changes: 21 additions & 2 deletions docs/platforms/godot/user-feedback/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The Sentry Godot SDK includes a reference User Feedback UI, which you can find i
- `user_feedback_form.tscn` + script: A minimal user feedback form, designed for integration into existing UI.
- `sentry_theme.tres`: The reference theme file used to customize the looks of user feedback UI.

For quick implementation, drag and drop `user_feedback_gui.tscn` from the addon folder to your scene tree under a `CanvasLayer` node and call `show()` to display the feedback form. The form automatically scales to different viewport resolutions and handles its own visibility, hiding when users click "Submit" (sending feedback to Sentry) or "Cancel".
For quick implementation, drag and drop `user_feedback_gui.tscn` from the addon folder to your scene tree under a `CanvasLayer` node and call `show()` to display the feedback form. The form automatically scales to different viewport resolutions and handles its own visibility. It hides when users click "Submit" or "Cancel". On submission, it captures feedback on the next drawn frame so an attached screenshot shows the game instead of the form and any text entered into it.

![Feedback Form](./img/user_feedback_form.png)

Expand All @@ -41,7 +41,14 @@ Add `user_feedback_form.tscn` as a preview while editing the theme file to see y

### Integrating the Form Into Existing UI

For custom UI integration, use `user_feedback_form.tscn` instead. This component scene provides a flexible panel that can be embedded into other UI controls. Unlike the standalone GUI, you'll need to manage its visibility manually. The form exposes two signals for handling user interactions: `feedback_submitted` (triggered when feedback is sent) and `feedback_cancelled` (triggered when the user cancels the operation). After you instantiate the form inside your UI scene, you can use the provided signals to hide the form when it's no longer needed (or perform some other action):
For custom UI integration, use `user_feedback_form.tscn` instead. This component scene provides a flexible panel that can be embedded into other UI controls. Unlike the standalone GUI, you'll need to manage its visibility manually.

The form exposes two signals for handling user interactions:

- `feedback_submitted` is emitted after feedback is queued but before it's captured. Hide or free the form in response. The feedback is captured on the next drawn frame so an attached screenshot shows the game without the form or any text entered into it.
- `feedback_cancelled` is emitted when the user cancels the operation.

After you instantiate the form inside your UI scene, connect these signals to hide the form when it's no longer needed. The form is implemented in GDScript, so C# code connects to its signals by name. The submitted `SentryFeedback` reaches the C# handler as a `GodotObject`.

```gdscript {tabTitle:GDScript} {mdExpandTabs}
# Assuming you have already added the form to your scene with "UserFeedbackForm" unique name.
Expand Down Expand Up @@ -106,6 +113,18 @@ SentrySdk.CaptureFeedback(
name: "Bob");
```

### Exclude the Form From Feedback Screenshots

Calling `SentrySDK.capture_feedback()` while an in-game feedback form is visible can include the form and its contents in an attached screenshot. Schedule capture after the next frame is drawn, then immediately hide or free the form:

```GDScript
RenderingServer.frame_post_draw.connect(
SentrySDK.capture_feedback.bind(feedback), CONNECT_ONE_SHOT)
user_feedback_form.hide()
```

Feedback events don't pass through `before_send`. To inspect, modify, or drop feedback before it's sent, see [Filtering User Feedback](/platforms/godot/configuration/filtering/#filtering-user-feedback).

Sentry can optionally pair this feedback with an event, giving you additional insight into issues. Sentry needs the `event_id` to be able to associate the user feedback to the corresponding event. For example, to get the `event_id`, you can use <PlatformLink to="/configuration/options/#before_send">before_send</PlatformLink>, or the return value of the method capturing an event.

```gdscript {tabTitle:GDScript} {mdExpandTabs}
Expand Down
Loading