Skip to content

User Profiling

NearIT creates an anonymous profile for every user of your app. You can choose to add data to user profile. This data will be available inside recipes to allow the creation of user targets.

Add User-data to NearIT

You can set user data with this method:

NearPCL.SetUserData("name", "Jhon");

If you want to set a date as a value, you have to use the format "MM-dd-yyyy".

If you want to set a multiple choice data point:

NearPCL.SetUserData("interests", new Dictionary<string, bool>() {
    { "food", true },
    { "drink", true },
    { "exercise",false }

WARNING: With multiple choice data points you should always provide an object with values for all the keys, even keys whose value did not change. Keys missing from the object will have their value overridden by false.

You can delete the value for a certain user data point, passing null as the value for its key:

NearPCL.SetUserData("gender", null as string);
NearPCL.SetUserData("interests", null as Dictionary<string, bool>);

Save the profile ID!

If you can, we recommend you to store the NearIT profileID in your CRM database for two main reasons:

  • it allows you to link our analytics to your users
  • it allows to associate all the devices of an user to the same NearIT profile.

You probably have a sign in system in your app, you should request the profile ID from NearIT before the user signs in:

NearPCL.GetProfileId((profileId) => {
    // save the profileID in your CRM
}, (error) => {
    // there was an error fetching the profileID

If you detect that your user already has a NearIT profile ID in your CRM database (i.e. after a sign in), you should pass the profile ID to NearIT:


Whenever a user signs out from your app, you should reset the NearIT profileID:

NearPCL.ResetProfileId((profileId) => {
    // a new empty profile was generated
}, (error) => {
    // your local profile was wiped, but no new profile was created


You can opt-out a profile and its device:

NearPCL.OptOut((_) => {
    //  opt-out successful
}, (error) => {
    //  network call failed, opt-out will affect the device only

If the opt-out call is successful all the user-data and trackings will be deleted and the SDK will cease to work (the user's devices will not receive further notifications).