Tracking Users

Integrate your app/website through NV SDKs.

NotifyVisitors begins to detect users right after you integrate your app's platform with our SDK’s. Thereafter, you can assign a unique User ID to every user to identify them.

NotifyVisitorsApi.getInstance(getActivity()).userIdentifier(String userID, JSONObject user_attributes);
NotifyVisitorsApi.getInstance(activityContext).userIdentifier(String userID, JSONObject user_attributes)

Benefits

  • You can add more information to your NotifyVisitors User Profile and create user segments for different categories of people with specific profile properties predefined by you.
  • You can design new campaigns to engage users in each segment you create.
  • Moreover, by adding additional information to your NotifyVisitors User Profile, you can personalize campaigns by means of including relevent information.
  • The third benefit includes the ability to personalize your app through specific information obtained from the users' NotifyVisitors User Profile.

User ID

It is important to set a unique ID so you can easily identify users across different devices. You can identify them whether the users install or uninstall your app across different platforms-

  • Android
  • iOS
  • Windows
  • The Web
  • ID that is backend generated

📘

Must Read:

We recommend that you must get familiar with all the concepts that are related with
Events and Users before you proceed to track users. It will help you to get a better grasp of this section.

As soon as you integrate your platform through our SDKs - which may be a website or an app, NotifyVisitors begins to detect users immediately. You can assign unique user ID to each user to identify them.

Every time a user visits your site, the SDK at NotifyVisitors creates a unique identity for the visitor. We are able to record users with the generated ID and also create a secret anonymous profile. The user’s behavioral data and along with it the session data is stored under the secret profile. The session data includes information like:

  • Custom Events
  • System Events
  • System Attributes of Users’
  • Custom Attributes of Users’

👍

Notes

Once user ID is assigned to the user, it cannot be changed further. Therefore make sure you pass system generated user ID instead of email or phone number which can be changed by user in future. The maximum limits for the unique user ID should have a limit of maximum 100 character.

We suggest that you should assign a unique ID- also referred to as CUID (Cluster Unique Identifier) at any of the following instances of User Lifecycle:

  • When User signs up
  • When User logs in
  • When user views pages where the ID becomes known
  • On change of User context

When a Cluster Unique Identifier or a CUID has been assigned to a User:

  • The user is now identified and now falls in the known user category
  • Automatically a fresh Profile for known-User Profile is created, containing all their data
  • All of their previous anonymous profiles get merged at this point to help you view a combined profile under the known-User Profile

The User API allows you to track the activity of users’ as they switch from device to device and keep adding attributes to the profiles. You can use these attributes to enrich profiles. The attributes include:

  • Email
  • Username
  • Gender
  • Mobile

You can use the API method upon identifying the user, which happens mostly at login.

👍

How does it Work:

How are profiles merged at the moment when the User is identified or CUID is assigned to the user?
Say, a user before signing up visits your app a couple of times.

  • Day 1 Visit to App: Notifyvisitors gives them a locally-unique identifier or LUID and makes a anonymous user profile automatically which maintains all their data (Anonymous Profile i).
  • User A revisits on Day 4: Notifyvisitors assigns a LUID again and yet creates one more anonymous profile and records data (Anonymous Profile ii).
  • Again the user revisits the app on Day 7 and then registers for an account: This time you assign a CUID to the user. This will create a new profile.
  • The moment a Known User Profile is made, Notifyvisitors will make a quick check for previously created anonymous user profiles after identifying them.
  • Now, the Anonymous Profile i and Profile ii will be merged into the final profile of the User A. Hereon, there will be a unified view of the User A profile with record of the user’s behavioral history and preferences.

Guidelines

  • All APIs related to users are a part of Notifyvisitors’ user object of the Android SDK
  • You cannot change your assigned user ID
  • Maximum number of characters allowed in making your user ID have to be under a 100 characters
  • User ID cannot be changed further once established. Unique ID means having a distinctive user identity.

User Attributes

User Attribute are attributes related to the user profile as following:

  • User's name
  • Email address
  • Location

There are two types of User Attributes:

  • System User Attributes
  • Custom User Attributes

Both attributes are tracked for known users and anonymous users.

System User Attributes

System user attributes are the attributes which are passed by you and recognized by NotifyVisitors system.

Guidelines

  • Notifyvisitors’ allows professionals to assign values to all attributes for your app users.
  • System User Attributes cannot be used for segmenting the users.
  • You can use the attributes to configure personalize messages.
  • They are better than event attributes which may take different values in every session.
  • Record details using User attributes as they do not change and their details are the same throughout one session.

Look at the below table to refer to the system attributes :

Attribute KeyAttribute ValueAttribute description
user_idstring
namestring
first_namestring
last_namestring
emailstringEmail ID
mobilestringPhone number of the user in E.164 format
eg. +551155256325, +917850009678
birth_dateDateBirth date in YYYY-MM-DD format
genderstringGender - value can only be one of male, female, other
email_opt_ininteger1 -> reachable on email 0 -> not available , 2 -> bounced
sms_opt_ininteger1 -> reachable on sms , 0 -> not available , 2 -> invalid
whatsapp_opt_ininteger1 -> opt in for whatsapp , 0 -> no, 2 -> invalid
hashed_emailstringEncrypted email address for use with a private ESP
hashed_mobilestringEncrypted phone number for use with a private ESP

Setting System Attribute

Name

JSONObject userObject = new JSONObject();
try {
   userObject.put("name","John");
} catch (JSONException e) {
   e.printStackTrace();
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject);
val userObject = JSONObject()
try {
   userObject.put("name","John")
} catch (e: JSONException) {
   e.printStackTrace()
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject)

Email

JSONObject userObject = new JSONObject();
try {
   userObject.put("email","[email protected]");
} catch (JSONException e) {
   e.printStackTrace();
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject);
val userObject = JSONObject()
try {
   userObject.put("email","[email protected]")
} catch (e: JSONException) {
   e.printStackTrace()
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject)

Hashed Email
Businesses do not like to share their users’ contact details with a third party platform
like Notifyvisitors. So we have provided you to pass encrypted email IDs in the
system user attribute.

JSONObject userObject = new JSONObject();
try {
   userObject.put("hashed_email","144e0424883546e07dcd727057fd3b62");
} catch (JSONException e) {
   e.printStackTrace();
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject);
val userObject = JSONObject()
try {
  userObject.put("hashed_email","144e0424883546e07dcd727057fd3b62")
} catch (e: JSONException) {
  e.printStackTrace()
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject)

Mobile No

JSONObject userObject = new JSONObject();
try {
   userObject.put("mobile","+919999999999");
} catch (JSONException e) {
   e.printStackTrace();
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject);
val userObject = JSONObject()
try {
   userObject.put("mobile","+919999999999")
} catch (e: JSONException) {
   e.printStackTrace()
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject)

Birth Date (in YYYY-MM-DD format)

JSONObject userObject = new JSONObject();
try {
   userObject.put("birth_date","1986-08-19");
} catch (JSONException e) {
   e.printStackTrace();
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject);
val userObject = JSONObject()
try {
  userObject.put("birth_date","1986-08-19")
} catch (e: JSONException) {
  e.printStackTrace()
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject)

Opt In Status

  • Set subscription preference of your users for:
  1. SMS
  2. Email
  3. WhatsApp 

Use the following methods:

JSONObject userObject = new JSONObject();
try {
   userObject.put("whatsapp_opt_in",1);
} catch (JSONException e) {
   e.printStackTrace();
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject);
val userObject = JSONObject()
try {
  userObject.put("whatsapp_opt_in",1)
} catch (e: JSONException) {
  e.printStackTrace()
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject)
  • Those user who have shared their phone number and email address and automatically opted in to SMS and Email respectively.
  • By default the WhatsApp opt-in setting is false. When the users decide to opt-in to channel you would have to set it to true
  • If the Users happen to opt-out of a channel, they will stop receiving and communications through that specific channel.

Custom Attributes

Custom attributes are the additional details passed by you for users . You can pass the user system attributes like name, email, mobile and whatsapp_opt_in in and, Custom attributes like user__score, plan_type etc as given below :

JSONObject userObject = new JSONObject();
try {
   userObject.put("name","john");
   userObject.put("number","98987XXXXX");
   userObject.put("user_score",'340');
   userObject.put("plan_type",3);
} catch (JSONException e) {
   e.printStackTrace();
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject);
val userObject = JSONObject()
try {
   userObject.put("name","john")
   userObject.put("number","98987XXXXX")
   userObject.put("user_score","340")
   userObject.put("plan_type",3)
} catch (e: JSONException) {
    e.printStackTrace()
}

NotifyVisitorsApi.getInstance(activityContext).userIdentifier("1331", userObject)

Important Points :

  1. Values of an attribute can have only one of the following data types :Boolean, Number, String, Date, Map and Array.
  2. There are maximum 25 custom attributes per datatype. For example, 25 custom attributes of Number data type and 25 custom attributes of String data type etc.
  3. The maximum length of a String data type for an attribute is 1000 characters.
  4. The maximum length of an attribute Key is 50 characters.
  5. Attribute Names should contain only alpha-numeric, white spaces or "" . No other special characters are allowed. Recommended names should be - ‘first name’, ‘last_name’.

Complex Attributes

Your user details may have more complex info like

  • Array
  • objects

NotifyVisitors UID

NV UID stands for NotifyVisitors Unique Identifier. We create this ID on our backend site and assign a unique ID to each user, whether they're known or anonymous. This ID can be seen in the NV dashboard → Mobile Push → Subscribers section.

If you want to use this UID in your application depending on your use case, you can implement the following function which will return the UID in string format.

NotifyVisitorsApi.getInstance(activityContext).getNvUid();
NotifyVisitorsApi.getInstance(activityContext).nvUid: String?

You can check out an example by using the above code in the logs to print NV-UUID,

Log.d("App", "NV_UUID = " + NotifyVisitorsApi.getInstance(activityContext).getNvUid());
Log.d(“App”, "NV_UUID = " + NotifyVisitorsApi.getInstance(activityContext).nvUid)

The above example will print the below response & returns data as a string. If in any case if there is no NV-UUID is generated or fetched by the SDK, then it will return as a null string or an empty string.

App: NV_UUID = cb506278-d427458a-976b00748de49bdc