diff --git a/docs/platforms/unreal/configuration/filtering.mdx b/docs/platforms/unreal/configuration/filtering.mdx index 4fc0ee527cf2e..ccefa5c2363f0 100644 --- a/docs/platforms/unreal/configuration/filtering.mdx +++ b/docs/platforms/unreal/configuration/filtering.mdx @@ -21,3 +21,19 @@ All Sentry SDKs support the callback m Note also that breadcrumbs can be filtered, as discussed in [our Breadcrumbs documentation](/product/issues/issue-details/breadcrumbs/). + +## Filtering User Feedback + +Configure your SDK to filter user feedback by using the `beforeSendFeedback` callback method. + +### Using `beforeSendFeedback` + +The `beforeSendFeedback` callback is called immediately before user feedback is sent to Sentry. It receives the feedback event as a parameter, which you can use to modify or enrich the event (for example, adjusting the feedback message, tags, or contexts, or scrubbing sensitive data), or drop it completely by returning `null`. + + + +`beforeSendFeedback` is currently not supported on macOS and iOS. + + + + diff --git a/platform-includes/configuration/before-send-feedback/unreal.mdx b/platform-includes/configuration/before-send-feedback/unreal.mdx new file mode 100644 index 0000000000000..ed8749f851c22 --- /dev/null +++ b/platform-includes/configuration/before-send-feedback/unreal.mdx @@ -0,0 +1,36 @@ +```cpp +UCLASS() +class USomeBeforeSendFeedbackHandler : public USentryBeforeSendFeedbackHandler +{ + GENERATED_BODY() + +public: + virtual USentryEvent* HandleBeforeSendFeedback_Implementation(USentryEvent* Event, USentryHint* Hint) override + { + // The feedback fields are available through the event + if (USentryFeedback* Feedback = Event->GetFeedback()) + { + // Scrub or modify the feedback before it's sent + Feedback->SetContactEmail(TEXT("redacted@example.com")); + } + + return Super::HandleBeforeSendFeedback_Implementation(Event, Hint); + } +}; + +... + +FConfigureSettingsDelegate SettingsDelegate; +SettingsDelegate.BindDynamic(this, &USomeClass::HandleSettingsDelegate); + +void USomeClass::HandleSettingsDelegate(USentrySettings* Settings) +{ + Settings->BeforeSendFeedbackHandler = USomeBeforeSendFeedbackHandler::StaticClass(); +} + +... + +USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem(); + +SentrySubsystem->InitializeWithSettings(SettingsDelegate); +```