---
title: "Scrubbing Sensitive Data"
description: "Learn about filtering or scrubbing sensitive data within the Sentry Unity SDK, so that data is not sent with the event. You can also configure server-side scrubbing to ensure the data is not stored."
url: https://docs.sentry.io/platforms/unity/data-management/sensitive-data/
---

# Scrubbing Sensitive Data for Unity

As with any third-party service it's important to understand what data is being sent to Sentry, and where relevant ensure sensitive data either never reaches the Sentry servers, or at the very least it doesn’t get stored.

These are some great examples for data scrubbing that every company should think about:

* PII (Personally Identifiable Information) such as a user's name or email address, which post-GDPR should be on every company's mind.
* Authentication credentials, like your AWS password or key.
* Confidential IP (Intellectual Property), such as your favorite color, or your upcoming plans for world domination.

We offer the following options depending on your legal and operational needs:

* filtering or scrubbing sensitive data within the SDK, so that data is *not sent to* Sentry. Different SDKs have different capabilities, and configuration changes require a redeployment of your application.
* [configuring server-side scrubbing](https://docs.sentry.io/security-legal-pii/scrubbing/server-side-scrubbing.md) to ensure Sentry does *not store* data. Configuration changes are done in the Sentry UI and apply immediately for new events.
* [running a local Relay](https://docs.sentry.io/product/relay.md) on your own server between the SDK and Sentry, so that data is *not sent to* Sentry while configuration can still be applied without deploying.

## [Scrubbing Data in the SDK](https://docs.sentry.io/platforms/unity/data-management/sensitive-data.md#scrubbing-data-in-the-sdk)

To remove sensitive data before it leaves the device, use these callbacks:

* [`SetBeforeSend`](https://docs.sentry.io/platforms/unity/configuration/options.md#SetBeforeSend): edit or drop error events.
* [`SetBeforeBreadcrumb`](https://docs.sentry.io/platforms/unity/configuration/options.md#SetBeforeBreadcrumb): edit or drop breadcrumbs.
* [`SetBeforeSendTransaction`](https://docs.sentry.io/platforms/unity/configuration/options.md#SetBeforeSendTransaction): edit or drop transactions.
* `SetBeforeSendLog`: edit or drop logs. Learn more in [Logs](https://docs.sentry.io/platforms/unity/logs.md#before-log-handler).
* [`SetBeforeCaptureScreenshot`](https://docs.sentry.io/platforms/unity/configuration/options.md#SetBeforeCaptureScreenshot) and [`SetBeforeSendScreenshot`](https://docs.sentry.io/platforms/unity/configuration/options.md#SetBeforeSendScreenshot): skip, edit, or drop screenshots.
* [`SetBeforeCaptureViewHierarchy`](https://docs.sentry.io/platforms/unity/configuration/options.md#SetBeforeCaptureViewHierarchy) and [`SetBeforeSendViewHierarchy`](https://docs.sentry.io/platforms/unity/configuration/options.md#SetBeforeSendViewHierarchy): skip, edit, or drop the view hierarchy.

These callbacks run in C# only. Native crashes, from C and C++, Java and Kotlin, or Objective-C and Swift code, are captured by the native SDKs and don't run them. Breadcrumbs reach the native SDKs after `SetBeforeBreadcrumb` runs, so breadcrumbs you edit or drop there stay that way in native crashes. To remove other data from native crashes, use [server-side scrubbing](https://docs.sentry.io/security-legal-pii/scrubbing/server-side-scrubbing.md). On iOS, setting `SetBeforeCaptureScreenshot` or `SetBeforeSendScreenshot` turns off screenshots for native crashes. On Windows, native crashes get a screenshot whenever `AttachScreenshot` is on. Learn more in [Screenshots](https://docs.sentry.io/platforms/unity/enriching-events/screenshots.md#native-errors).

Ensure that your team is aware of your company's policy around what can and cannot be sent to Sentry. We recommend determining this policy early in your implementation and communicating it as well as enforcing it via code review.

If you are using Sentry in your mobile app, read our [frequently asked questions about mobile data privacy](https://docs.sentry.io/security-legal-pii/security/mobile-privacy.md) to assist with Apple App Store and Google Play app privacy details.

If you *do not* wish to use the default PII behavior, you can also choose to identify users in a more controlled manner, using our [user identity context](https://docs.sentry.io/platforms/unity/enriching-events/identify-user.md).
