API Reference

How to track users? How to send user attributes to Nudge?

Overview

Users in the context of Nudge are individuals who use your application. Nudge views users as central to the dynamic and personalized experiences you aim to create. By tracking user interactions and gathering data on their behaviors, Nudge facilitates the personalization of the in-app experience to meet diverse user needs.

Tracking a user

You can track the users of your application by using Nudge's APIs and SDKs

  await nudge.initSession({externalId:'CLIENT_IDENTIFIABLE_USER_ID'});
nudge.initSession("externalId", properties, new Nudge.InitSessionCallback() {
    @Override
    public void onSuccess() {
        // Handle success
    }

    @Override
    public void onError(Exception e) {
        // Handle error
    }
});
nudge.initSession(CLIENT_IDENTIFIABLE_USER_ID, null, object : Nudge.InitSessionCallback {
                override fun onSuccess() {
                    // Handle success
                }
                override fun onError(e: Exception) {
                    // Handle error
                }
            })
await core.initSession(externalId:'CLIENT_IDENTIFIABLE_USER_ID');

User properties

User properties are the attributes of a user that you can send while creating or updating a user. These properties can be used to target users and analyze their behavior.

 await nudge.initSession({externalId:'CLIENT_IDENTIFIABLE_USER_ID',
                  properties:{
                  	"name": "Client User 1",
                  	"age": 27,
                  	"gender": "M",
                  	"country":"US",
                  }});
JSONObject userProperties = new JSONObject();
userProperties.put("name","Client User 1");
userProperties.put("age", 27);
userProperties.put("gender", "M");
userProperties.put( "country","US");

nudge.initSession(apiKey: <TOKEN>, externalId:'CLIENT_IDENTIFIABLE_USER_ID',properties: userProperties);
val userProperties = JSONObject().apply {
    put("name", "Client User 1")
    put("age", 27)
    put("gender", "M")
    put("country", "US")
}
nudge.initSession(apiKey = "<TOKEN>", externalId = "CLIENT_IDENTIFIABLE_USER_ID", properties = userProperties)
 await core.initSession('CLIENT_IDENTIFIABLE_USER_ID',
                  properties: <String, dynamic>{
                  "name": "Client User 1",
                  "age": 27,
                  "gender": "M",
                  "country":"US",
                  });