For the complete documentation index, see llms.txt. This page is also available as Markdown.

User Identifier & Properties

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

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.

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.

Additional identifiers are not consolidated into the Hackle ID.


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.

Category
Type
Constraints

Property Key

string

  • Character limit is 128 characters.

  • Case-insensitive.

  • For example, AGE and age are recognized as the same Property Key.

Property Value

boolean, string, number, array

  • For string type, the character limit is 1024 characters.

  • String type is case-sensitive.

  • For example, APPLE and apple are recognized as different Property Values.

  • For number type, up to 15 integer digits and up to 6 decimal places are supported.

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.

Setting User Properties

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

Supported Functions
Description

set

Sets a User Property. If a Property Value already exists for the Property Key, it is overwritten.

setOnce

Sets a User Property value only once. If a property already exists for the Property Key, it is ignored.

For example, you can use this to set a user's registration date or initial sign-up location.

unset

Removes a User Property.

clearAll

Removes all User Properties.

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.

Last updated