User Identifier & Properties

The User Identifier is used to uniquely identify a user. For the meaning and importance of User Identifiers and guidelines for choosing one, refer to the Managing User Identifiers document.

Using the Device Identifier Managed Internally by the SDK

circle-exclamation

Client-side SDKs include functionality for managing the device identifier internally. Users are automatically identified through the internally managed device identifier.

Using a Custom Identifier

This method passes a User Identifier directly as a parameter. The identifier you pass can be a Primary Key you manage yourself, a device identifier, a member ID, an email address, a hash value, etc.

  • Sample code for creating a custom identifier is provided at the bottom of this document.


Client-side SDK

You can use a User Identifier in two ways.

  • Using the device identifier managed internally by the SDK

  • Using a custom identifier

Using the Device Identifier Managed Internally by the SDK

Client-side SDKs include functionality for managing the device identifier. Therefore, users can be automatically identified without passing a separate User Identifier. For JavaScript, Android, and iOS, you can obtain the device identifier managed by the SDK — refer to the example code below.

// Variation distribution
const experimentKey = 42
const variation = hackleClient.variation(experimentKey)

// Event tracking
hackleClient.track("purchase")

// Get the internally managed device identifier
const userId = Hackle.getUserId()

Using a Custom Identifier

The SDK identifies users via the identifier passed as a parameter. The identifier you pass can be a Primary Key you manage yourself, a device identifier, a member ID, an email address, a hash value, etc.


Server-side SDK

Since the Server-side SDK cannot identify users on its own, you must always pass a custom identifier as a parameter.


Example: Creating a Custom Identifier

If you only need data for logged-in users, you can use the member ID or email address used at login as the identifier. However, if you need to include non-logged-in users, it is recommended to use a value that can distinguish users based on the app, device, or browser. (For mobile apps, use a UUID or ADID value; for PC/Mobile web, use a cookie value.)

Below is an example of generating a User Identifier based on cookies.


Matching Identifiers Between Client and Server

When using Client and Server SDKs simultaneously, you can align the identifier for the same user across both environments.

In this case, it is recommended to pass the identifier via an HTTP header during client-server API communication, as shown below.

Property

The Hackle SDK supports adding properties to the User object. By sending user-specific information as User Properties, you can reduce repetitive coding while making rich use of them in A/B Tests and data analytics.

Properties must be sent as key-value pairs. A maximum of 64 properties can be added to a user object.

Property Key

Create keys like regular variable names, but make them easy to identify. The character limit is 128 characters. Case-insensitive. For example, AGE and age are recognized as the same Property Key.

Property Value

value supports boolean, string, and number types. For string type, the character limit is 1024 characters. String values are 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 decisions, and event tracking. The example below shows three properties (age, grade, is_paying_user) being added.

Last updated