User Identifier & Properties
User Identifier
Because server-side SDKs cannot identify users on their own, you must always pass the user object directly as a parameter. 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.
const user = {
userId: "143", // 사용자 ID
deviceId: "ae2182e0", // 디바이스 ID
}
// 테스트 그룹 분배
hackleClient.variation(experimentKey, user);
// 사용자 이벤트 전송
hackleClient.track("purchase", user);Additional Identifiers
To add identifier types other than the default identifiers (device_id, user_id), configure as follows.
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 128.
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.
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 updateUserProperties to update user properties. You can configure multiple properties at once.
Last updated