> ## 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.

# setUserAttributes()

> Merge user attributes (identity, location, subscription, engagement, custom string map) into the Encore Web SDK profile for offer targeting. Includes getUserAttributes().

Sets user attributes for offer targeting and personalization. Attributes are **merged** with
existing ones (including the `custom` map), never replaced wholesale, so set them
incrementally as you learn more about the user.

## Signature

```typescript theme={null}
function setUserAttributes(attributes: UserAttributes): void
```

Returns `void`. Attributes are persisted locally and sent with subsequent offer requests.

## UserAttributes

All fields are optional strings:

```typescript theme={null}
interface UserAttributes {
  // Identity
  email?: string;
  firstName?: string;
  lastName?: string;
  phoneNumber?: string;

  // Location
  postalCode?: string;
  city?: string;
  state?: string;
  countryCode?: string;
  latitude?: string;
  longitude?: string;

  // Demographics
  dateOfBirth?: string;   // ISO 8601
  gender?: string;
  language?: string;

  // Subscription
  subscriptionTier?: string;
  monthsSubscribed?: string;
  billingCycle?: string;
  lastPaymentAmount?: string;

  // Engagement
  lastActiveDate?: string;  // ISO 8601
  totalSessions?: string;

  // App-specific
  custom?: Record<string, string>;
}
```

## Examples

```javascript theme={null}
import Encore from '@encorekit/web-sdk';

Encore.setUserAttributes({
  email: 'user@example.com',
  subscriptionTier: 'premium',
  city: 'San Francisco',
  countryCode: 'US',
  custom: { accountType: 'business', referralSource: 'google' },
});
```

Incremental updates merge:

```javascript theme={null}
Encore.setUserAttributes({ subscriptionTier: 'free' });
Encore.setUserAttributes({ city: 'New York' });
// Both subscriptionTier and city are now set.
```

You can also pass attributes directly to
[`identify()`](/publishers/web/sdk-reference/identify) in the same call.

## getUserAttributes()

```typescript theme={null}
function getUserAttributes(): UserAttributes
```

Returns a copy of the currently merged attribute set:

```javascript theme={null}
const attributes = Encore.getUserAttributes();
```

## Related

* [`identify()`](/publishers/web/sdk-reference/identify): set attributes while identifying
* [User Management quickstart](/publishers/web/quickstart/user-management): the full identity model
