User Identifier & Properties
Using User Identifiers You Manage
Because server-side SDKs cannot identify users on their own, you must always pass the User Identifier directly as a parameter. The identifier you pass can be a primary key you manage, a device identifier, a member ID, an email, a hash value, etc.
Example
The following is an example of distributing a Variation and then sending a user event.
import io.hackle.sdk.HackleClient
import io.hackle.sdk.Hackle
import io.hackle.sdk.common.Variation
import io.hackle.sdk.common.Event
import io.hackle.sdk.common.User
val user: User = Hackle.user("ae2182e0")
// Variation Distribution
val variation: Variation = hackleClient.variation(experimentKey, user)
// Send user event
hackleClient.track(event, user)import io.hackle.sdk.HackleClient
import io.hackle.sdk.common.Variation
import io.hackle.sdk.common.Event
import io.hackle.sdk.common.User
User user = User.of("ae2182e0");
// Variation Distribution
Variation variation = hackleClient.variation(experimentKey, user);
// Send user event
hackleClient.track(event, user);Additional Identifiers
Additional identifiers beyond the default identifiers can be sent using the example code below.
Property
The Hackle SDK supports adding properties to a User object.
A property must be sent as a key-value pair consisting of a Property Key and a Property Value.
You can add a maximum of 128 properties per user object.
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.
Example
The User object is used as a parameter in Variation Distribution, Feature Flag Decision, and user event tracking.
In the example below, three properties (age, grade, is_paying_user) have been added.
Last updated