Tracking Users

Create a user profile to track users activity through Notifyvisitors.

NotifyVisitors start to detect users right after you integrate your app platform through our SDK’s. Hereafter, you can assign a unique UserID to every user to identify them.

notifyvisitors.userIdentifier("userID", userParams: userParametersDictionary)
[notifyvisitors UserIdentifier: @"userID" UserParams: userParametersDictionary];

Benefits

  • You can add more information to your Notifyvisitors User Profile and create a user segment for different categories of people with specific profile property predefined by you.
  • You can build new campaigns to engage your users for each segment that you create.
  • Secondly, by adding more info to your Notifyvisitors User Profile you can personalize your messaging for the campaigns with related information.
  • The third benefit includes personalizing your app created from information from the specific 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 a unique user ID to each user to identify them.

Every time a user visits your app, 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 a user ID is assigned to the user, it cannot be changed further.

We suggest that you should assign a unique ID 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 Unique Identifier 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 unique identifier or NV_UID and makes an anonymous user profile automatically which maintains all their data (Anonymous Profile i).
  • 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 a record of the user’s behavioral history and preferences.

Guidelines

  • All APIs related to users are a part of Notifyvisitors user object of the iOS SDK
  • You cannot change your assigned userID
  • Maximum number of characters allowed in making your userID have to be under a 100 characters
  • UserID 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 personalized 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_idNSString
nameNSString
first_nameNSString
last_nameNSString
emailNSStringEmail ID
mobileNSStringPhone number of the user in E.164 format
eg. +551155256325, +91785000XXXX
birth_dateNSStringBirth date in YYYY-MM-DD format
genderNSStringGender - value can only be one of male, female, other
email_opt_inNSInteger1 -> reachable on email
0 -> not available , 2 -> bounced
sms_opt_inNSInteger1 -> reachable on sms,
0 -> not available , 2 -> invalid
whatsapp_opt_inNSInteger1 -> opt in for whatsapp , 0 -> no,
2 -> invalid
hashed_emailNSIntegerEncrypted email address for use with a private ESP
hashed_mobileNSIntegerEncrypted phone number for use with a private ESP

Setting System Attribute

Name

let userParameters = [:]
userParameters["name"] = "John"

let finalUserParams = NSMutableDictionary(dictionary: userParameters)

notifyvisitors.userIdentifier("1331", userParams: finalUserParams)
NSMutableDictionary *userParameters = [[NSMutableDictionary alloc] init];
[userParameters setObject: @"John" forKey: @"name"];


[notifyvisitors UserIdentifier: @"1331" UserParams: userParameters];

Email

let userParameters = [:]
userParameters["email"] = "[email protected]"

let finalUserParams = NSMutableDictionary(dictionary: userParameters)

notifyvisitors.userIdentifier("1331", userParams: finalUserParams)
NSMutableDictionary *userParameters = [[NSMutableDictionary alloc] init];
[userParameters setObject: @"[email protected]" forKey: @"email"];


[notifyvisitors UserIdentifier: @"1331" UserParams: userParameters];

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

let userParameters = [:]
userParameters["hashed_email"] = "144e0424883546e07dcdXXXXXXXXXXXX"

let finalUserParams = NSMutableDictionary(dictionary: userParameters)

notifyvisitors.userIdentifier("1331", userParams: finalUserParams)
NSMutableDictionary *userParameters = [[NSMutableDictionary alloc] init];
[userParameters setObject: @"144e0424883546e07dcdXXXXXXXXXXXX" forKey: @"hashed_email"];


[notifyvisitors UserIdentifier: @"1331" UserParams: userParameters];

Mobile No

let userParameters = [:]
userParameters["mobile"] = "+9198189XXXXX"

let finalUserParams = NSMutableDictionary(dictionary: userParameters)

notifyvisitors.userIdentifier("1331", userParams: finalUserParams)
NSMutableDictionary *userParameters = [[NSMutableDictionary alloc] init];
[userParameters setObject: @"+9198189XXXXX" forKey: @"mobile"];


[notifyvisitors UserIdentifier: @"1331" UserParams: userParameters];

Birth Date (in YYYY-MM-DD format)

let userParameters = [:]
userParameters["birth_date"] = "1986-08-19"

let finalUserParams = NSMutableDictionary(dictionary: userParameters)

notifyvisitors.userIdentifier("1331", userParams: finalUserParams)
NSMutableDictionary *userParameters = [[NSMutableDictionary alloc] init];
[userParameters setObject: @"1986-08-19" forKey: @"birth_date"];


[notifyvisitors UserIdentifier: @"1331" UserParams: userParameters];

Opt In Status

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

Use the following methods:

let userParameters = [:]
userParameters["whatsapp_opt_in"] = "1"

let finalUserParams = NSMutableDictionary(dictionary: userParameters)

notifyvisitors.userIdentifier("1331", userParams: finalUserParams)
NSMutableDictionary *userParameters = [[NSMutableDictionary alloc] init];
[userParameters setObject: @"1" forKey: @"whatsapp_opt_in"];


[notifyvisitors UserIdentifier: @"1331" UserParams: userParameters];
  • Those users 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 communicating 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 no, whatsapp_opt_in and custom attributes of your choice (for example: user__score, plan_type e.t.c.) as given below:

let userParameters = [:]
userParameters["name"] = "John"
userParameters["email"] = "[email protected]"
userParameters["mobile"] = "+9198189XXXXX"
userParameters["user_score"] = "340"
userParameters["plan_type"] = "3"

let finalUserParams = NSMutableDictionary(dictionary: userParameters)

notifyvisitors.userIdentifier("1331", userParams: finalUserParams)
NSMutableDictionary *userParameters = [[NSMutableDictionary alloc] init];
[userParameters setObject: @"John" forKey: @"name"];
[userParameters setObject: @"[email protected]" forKey: @"email"];
[userParameters setObject: @"+9198189XXXXX" forKey: @"mobile"];
[userParameters setObject: @"340" forKey: @"user_score"];
[userParameters setObject: @"3" forKey: @"plan_type"];


[notifyvisitors UserIdentifier: @"1331" UserParams: userParameters];

Important Points :

  1. Values of an attribute can have only one of the following data types: Bool, NSNumber, NSString, NSDictionary and NSArray.
  2. There are a maximum 25 custom attributes per datatype. For example, 25 custom attributes of NSNumber data type and 25 custom attributes of NSString data type etc.
  3. The maximum length of a NSString 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

You can pass complex user attributes with Notifyvisitors as NSMutableDictionary data type.

let planDetailsDict = ["plan_type": NSNumber(value: 3), "plan_name": "gold", "plan_price": “299”]

let userParameters = [:]
userParameters["name"] = "John"
userParameters["email"] = "[email protected]"
userParameters["mobile"] = "+9198189XXXXX"
userParameters["user_score"] = "340"
userParameters["plan_detail"] = planDetailsDict

let finalUserParams = NSMutableDictionary(dictionary: userParameters)

notifyvisitors.userIdentifier("1331", userParams: finalUserParams)
NSDictionary *planDetailsDict = @{@"plan_type" : @(3), @"plan_name" : @"gold", @"plan_price" : @"299"};

NSMutableDictionary *userParameters = [[NSMutableDictionary alloc] init];
[userParameters setObject: @"John" forKey: @"name"];
[userParameters setObject: @"[email protected]" forKey: @"email"];
[userParameters setObject: @"+9198189XXXXX" forKey: @"mobile"];
[userParameters setObject: @"340" forKey: @"user_score"];
[userParameters setObject: planDetailsDict forKey: @"plan_detail"];


[notifyvisitors UserIdentifier: @"1331" UserParams: userParameters];

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 dashboardMobile PushSubscribers 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.

notifyvisitors.getNvUid { (nv_UIDStr) in {
print("notifyvisitors nv uid = \(nv_UIDStr!)")
}
[notifyvisitors getNvUid:^(NSString *nv_UIDStr) {
NSLog(@"notifyvisitors nv uid = %@", nv_UIDStr);
}];

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