Skip to main content

Identifying users

Identification

You can identify users using the userIdentifier method in our SDK. This method requires a unique user identifier and allows you to include additional user properties within a properties object.

info
  • To display the user's name, email, and phone number in the Nudge dashboard, pass these properties separately and do not include them again inside the props object.
  • Keys in properties map should be in smaller case
  • If you are sending any string properties the length should nt exceed 256 Characters
val props = HashMap<String, Any>().apply {
put("sample_string_data", "20") // String
put("sample_float_data", 17.5) // Float
put("sample_int_data", 11) // Int
put("sample_boolean_data", false) // Boolean
}

Nudge.getInstance().userIdentifier(
externalId = "unique_id_for_user", //String (Required)
name = "User Name", //String? (Optional)
email = "[email protected]", //String? (Optional)
phoneNumber = "9999999999" //Strin? (Optional)
properties = props, // HashMap<String,Any>? (Optional)
onResult = object : Nudge.NudgeResponse {
override fun onSuccess(response: String) {
// Handle success
}

override fun onFailure(error: String) {
// Handle failure
}
})

Signing out users

Once the user signs out from your application, use the userSignOut method provided by Nudge to clear any cached data for that user.

Nudge.getInstance().userSignOut(
onResult = object : Nudge.NudgeResponse {
override fun onSuccess(response: String) {

}
override fun onFailure(error: String) {

}
})