> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encorekit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# User Management

> Identifying users, setting attributes, and managing identity in your React Native app.

## Overview

Encore requires user identification to track entitlements and prevent abuse across devices. You can also set user attributes to enable targeted offers and personalization.

***

## Anonymous Users

Encore **automatically generates** a random user ID that persists until the user deletes/reinstalls your app or calls `reset()`.

This anonymous ID allows entitlement tracking to work immediately without requiring explicit user identification.

***

## Identified Users

If you use your own user management system, call `identify()` when you have a user's identity:

```tsx theme={null}
await Encore.identify(user.id);
```

This enables the SDK to:

* Associate promotional access with your user account
* Sync entitlements across devices when the user logs in
* Track conversion attribution accurately

***

## Resetting User Identity

When a user logs out, call `reset()`:

```tsx theme={null}
await Encore.reset();
```

This will:

* Reset the user ID to a new auto-generated anonymous ID
* Clear cached entitlement data
* Clear all user attributes

***

## Setting User Attributes

User attributes enable personalized offers, audience targeting, and conversion context tracking.

### Usage

```tsx theme={null}
await Encore.setUserAttributes({
  email: 'user@example.com',
  subscriptionTier: 'premium',
  monthsSubscribed: '6',
  custom: {
    cancelReason: 'too_expensive',
  },
});
```

You can also set attributes when identifying:

```tsx theme={null}
await Encore.identify(user.id, {
  email: user.email,
  subscriptionTier: user.plan,
  monthsSubscribed: String(user.monthsActive),
});
```

**Important:** `setUserAttributes()` **merges** with existing attributes — it does not replace them.

<Tip>
  See the SDK Reference for details: [identify()](../reference/identify), [setUserAttributes()](../reference/set-user-attributes), and the full [UserAttributes](../reference/user-attributes) field list.
</Tip>

***

## Implementation Examples

### With useEncoreContext Hook

```tsx theme={null}
import { useEncoreContext } from '@tryencorekit/react-native';

function ProfileScreen() {
  const encore = useEncoreContext();

  const handleLogin = async (user) => {
    await encore.identify(user.id, {
      email: user.email,
      subscriptionTier: user.plan,
    });
  };

  const handleLogout = async () => {
    await encore.reset();
  };

  return (
    // ...
  );
}
```

### Apps Without Login

If your app doesn't require users to log in, no additional setup is needed:

```tsx theme={null}
// Anonymous users work automatically — just set attributes if needed
await Encore.setUserAttributes({
  custom: { cancelReason: 'too_expensive' },
});
```

***

## Next Steps

* [Present Offers](./present-offers) - Show promotional offers and handle purchase results
