# Users | Sentry for Unreal Engine

Users consist of a few critical pieces of information that construct a unique identity in Sentry. Each of these is optional, but one **must** be present for the Sentry SDK to capture the user:

### [`id`](https://docs.sentry.io/platforms/unreal/enriching-events/identify-user.md#id)

Your internal identifier for the user.

### [`username`](https://docs.sentry.io/platforms/unreal/enriching-events/identify-user.md#username)

The username. Typically used as a better label than the internal id.

### [`email`](https://docs.sentry.io/platforms/unreal/enriching-events/identify-user.md#email)

An alternative, or addition, to the username. Sentry is aware of email addresses and can display things such as Gravatars and unlock messaging capabilities.

### [`ip_address`](https://docs.sentry.io/platforms/unreal/enriching-events/identify-user.md#ip_address)

The user's IP address. If the user is unauthenticated, Sentry uses the IP address as a unique identifier for the user. Serverside SDKs that instrument incoming requests will attempt to pull the IP address from the HTTP request data (`request.env.REMOTE_ADDR` field in JSON), if available. That might require `SendDefaultPii` set to `true` in the SDK options.

If the user's `ip_address` is set to `"{{auto}}"`, Sentry will infer the IP address from the connection between your app and Sentry's server.

If the field is omitted, the default value is `null`. However, due to backwards compatibility concerns, certain platforms (in particular JavaScript) have a different default value for `"{{auto}}"`. SDKs and other clients should not rely on this behavior and should set IP addresses or `"{{auto}}"` explicitly.

To opt out of storing users' IP addresses in your event data, you can go to your project settings, click on "Security & Privacy", and enable "Prevent Storing of IP Addresses" or use Sentry's [server-side data](https://docs.sentry.io/security-legal-pii/scrubbing.md) scrubbing to remove `$user.ip_address`. Adding such a rule ultimately overrules any other logic.

Additionally, you can provide arbitrary key/value pairs beyond the reserved names, and the Sentry SDK will store those with the user.

To identify the user:

```cpp
USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem<USentrySubsystem>();

TMap<FString, FString> AdditionalData;
AdditionalData.Add("DogName", "Spot");

USentryUser* User = NewObject<USentryUser>();
User->Initialize();
User->SetEmail("user@sentry.io");
User->SetId("123");
User->SetUsername("AwesomeUser99");
User->SetIpAddress("127.0.0.1");
User->SetData(AdditionalData);

SentrySubsystem->SetUser(User);
```

The same result can be achieved by calling corresponding function in blueprint:

Alternatively, this configuration can be provided to the crash reporter [during initialization](https://docs.sentry.io/platforms/unreal/configuration/setup-crashreporter.md#configure-attributes).

You can also clear the currently set user:

```cpp
USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem<USentrySubsystem>();

SentrySubsystem->RemoveUser();
```

Or in blueprint:

In configurations with a crash reporter, create a new `__sentry` config object without the `user` field. Then, call `FGenericCrashContext::SetGameData` from the [initialization function](https://docs.sentry.io/platforms/unreal/configuration/setup-crashreporter.md#configure-attributes) with the new JSON data. You have to provide all other fields again, as the call overrides the previously registered data.
