# User Identifier & Properties

{% hint style="info" %}
User Identifier Management

User Identifiers are used for the purpose of uniquely identifying users. For information about the meaning and importance of User Identifiers and criteria for choosing them, refer to the [Managing User Identifiers](/en/getting-started/user-identifier.md) documentation.
{% endhint %}

## User Identifier

Because server-side SDKs cannot identify users on their own, you must **always pass the User Identifier directly as a parameter** when calling Hackle features. The identifier you pass can be a Primary Key you manage directly, a device identifier, a member ID, an email address, a hash value, or similar.

### Identifiers Provided by Hackle

The default identifiers provided by Hackle are `user_id` and `device_id`.

```python
from hackle.model import HackleUser

user = HackleUser.builder() \
                 .user_id('user_id') \     # 사용자 ID
                 .device_id('device_id') \ # 디바이스 ID
                 .build()

# 테스트 그룹 분배
variation = hackle_client.variation(experiment_key=42, user=user)

# 사용자 이벤트 전송
hackle_client.track(event=event, user=user)
```

### Additional Identifiers

To add identifier types other than the default identifiers (device\_id, user\_id), configure as follows.

{% hint style="info" %}
Additional identifiers are not consolidated into the [Hackle ID](/en/getting-started/user-identifier/hackle-id.md).
{% endhint %}

```python
from hackle.model import HackleUser

user = HackleUser.builder() \
                 .user_id('143') \                   # 사용자 ID (핵클 통합 식별자 사용가능)
                 .device_id('ae2182e0') \            # 디바이스 ID (핵클 통합 식별자 사용가능)
                 .identifier('my_custom_id', '42') \ # Custom ID
                 .build()
```

***

## User Property

The Hackle SDK supports adding user properties.

* A property must be sent as a pair of a Property Key (key) and a Property Value (value).
* The maximum number of properties that can be added is 64.

<table><thead><tr><th width="133.04296875">Category</th><th width="127.60546875">Type</th><th>Constraints</th></tr></thead><tbody><tr><td>Property Key</td><td><code>string</code></td><td><ul><li>Character limit is 128 characters.</li><li>Case-insensitive.</li><li>For example, AGE and age are recognized as the same Property Key.</li></ul></td></tr><tr><td>Property Value</td><td><code>boolean</code>, <code>string</code>, <code>number</code>, <code>array</code></td><td><ul><li>For string type, the character limit is 1024 characters.</li><li>String type is case-sensitive.</li><li>For example, APPLE and apple are recognized as different Property Values.</li><li>For number type, up to 15 integer digits and up to 6 decimal places are supported.</li></ul></td></tr></tbody></table>

### Adding User Properties

You can add user properties simply.

When calling Hackle features such as Variation Distribution, Feature Flag, or Event Tracking, add properties to the user object passed as a parameter,\
and the user properties are added along with that feature call.\
This behaves the same as adding properties using `set` in a `PropertyOperations` object.

In the example below, you can see that three properties (`age`, `grade`, `is_paying_user`) have been added.

```python
from hackle.model import HackleUser

user = HackleUser.builder() \
                 .device_id('ae2182e0') \
                 .property('age', 30) \               # 속성 추가
                 .property('grade', 'GOLD') \         # 속성 추가
                 .property('is_paying_user', False) \ # 속성 추가
                 .build()

# 테스트 그룹 분배
variation = hackle_client.variation(experiment_key, user)

# 기능 플래그 결정
feature_on = hackle_client.is_feature_on(feature_key, user)

# 사용자 이벤트 전송
hackle_client.track(event, user)
```

### Setting User Properties

You can add or remove user properties without calling other Hackle features.

<table><thead><tr><th width="150">Supported Functions</th><th>Description</th></tr></thead><tbody><tr><td><code>set</code></td><td>Sets a User Property. If a Property Value already exists for the Property Key, it is overwritten.</td></tr><tr><td><code>setOnce</code></td><td><p>Sets a User Property value only once. If a property already exists for the Property Key, it is ignored.</p><p>For example, you can use this to set a user's registration date or initial sign-up location.</p></td></tr><tr><td><code>unset</code></td><td>Removes a User Property.</td></tr><tr><td><code>clearAll</code></td><td>Removes all User Properties.</td></tr></tbody></table>

Instantiate a `PropertyOperations` object with the user properties you want to configure.\
Then call `update_user_properties` to update user properties. You can configure multiple properties at once.

```python
from hackle.model import HackleUser, PropertyOperations

user = HackleUser.builder() \
                 .device_id('ae2182e0') \
                 .build()

operations = PropertyOperations.builder() \
    .set("age", 42) \
    .set("grade", "GOLD") \
    .set_once("sign_up_date", "2020-07-03") \
    .unset("membership_type") \
    .build()

client.update_user_properties(user, operations)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hackle.io/en/development-guide/python/python-user-info.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
