Setting the User ID

The Incognia SDK automatically generates and synchronizes unique device IDs with the Incognia backend. However, your application and backend systems might use your own User IDs. Passing your User ID to the Incognia SDK allows for easier integration and control, as your User ID will be readily available as an alias.

Attention: An identifier is a piece of information that is associated with a unique user. While data such as e-mail and phone number are examples of identifiers, their use in the Incognia SDK is forbidden. Consider using non-personal information, such as UUIDs, when setting a User ID.

Setting User IDs

The Incognia SDK provides a User ID setter for passing this information when it is available in your app. This setting is persisted between sessions.

Kotlin
Java
Swift
Objective-C
Javascript
Kotlin
// Setting a User Id
InLoco.setUserId(context, "YOUR_USER_ID")
Java
// Setting a User Id
InLoco.setUserId(context, "YOUR_USER_ID");
Swift
// Setting a User Id
ILMInLoco.setUserId("YOUR_USER_ID")
Objective-C
// Setting a User Id
[ILMInLoco setUserId:@"YOUR_USER_ID"];
Javascript
// Setting a User Id
InLocoEngage.setUser("YOUR_USER_ID");

We highly recommend generating a User ID by means of hashing an internal value:

Clearing User IDs

You can also clear a previous set User ID using the following method:

Kotlin
Java
Swift
Objective-C
Javascript
Kotlin
// Clearing a User Id
InLoco.clearUserId(context)
Java
// Clearing a User Id
InLoco.clearUserId(context);
Swift
// Clearing a User Id
ILMInLoco.clearUserId()
Objective-C
// Clearing a User Id
[ILMInLoco clearUserId];
Javascript
// Clearing a User Id
InLocoEngage.clearUser();

Tips: If your app has authentication, it is recommended that the User ID is passed during login, and cleared during logout.

‚Äč