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

# User identification

> Identify users and set properties for targeting on Android

Identifying users lets you connect SDK sessions to real users in your system and target specific segments for studies.

For the concepts behind this, see [About identification](/sdk/concepts/identification).

## Set an external ID

Link the SDK session to a user in your system. This is typically the user ID from your database or auth system.

```kotlin theme={"theme":{"light":"github-light","dark":"github-dark"}}
PillowSDK.setExternalId("user_123")
```

Call this after login or whenever the user's identity is known.

<Note>
  The external ID must not be blank.
</Note>

## Set user properties

Attach metadata to the user for targeting and segmentation.

### String

```kotlin theme={"theme":{"light":"github-light","dark":"github-dark"}}
PillowSDK.setUserProperty("plan", "pro")
PillowSDK.setUserProperty("role", "engineering")
PillowSDK.setUserProperty("locale", "en-US")
```

### Boolean

```kotlin theme={"theme":{"light":"github-light","dark":"github-dark"}}
PillowSDK.setUserProperty("email_verified", true)
PillowSDK.setUserProperty("beta_user", false)
```

### Numeric

```kotlin theme={"theme":{"light":"github-light","dark":"github-dark"}}
PillowSDK.setUserProperty("login_count", 7)        // Int
PillowSDK.setUserProperty("lifetime_value", 49.5)   // Double
```

## Clear properties

```kotlin theme={"theme":{"light":"github-light","dark":"github-dark"}}
// Remove a single property
PillowSDK.clearUserProperty("plan")

// Remove all properties
PillowSDK.clearAllProperties()
```

## When to identify

| Event                          | Action                                                   |
| ------------------------------ | -------------------------------------------------------- |
| User logs in                   | Call `setExternalId()` and set known properties          |
| User updates profile           | Call `setUserProperty()` with new values                 |
| User logs out                  | Call `reset()` to clear identity and start fresh         |
| App launch (already logged in) | Call `setExternalId()` again, which the SDK deduplicates |

<Tip>
  You can call `setExternalId()` and `setUserProperty()` before or after a session is established. The SDK queues operations and sends them when the session is ready.
</Tip>
