These docs are for v1.0. Click to read the latest docs for v2.0.

Tracking User

Smartech SDK enables developers to identify a user and create a profile for the user with all its attributes. Assigning a unique user identity helps collect the user's activity and information across systems in a single unified view.
Unique user identity must be your primary key to identify users in your database.

We recommend not to use any user identity that can change over time.

Normally you can set the user identity in the following flow of your app:

  1. On user sign-in/login success.
  2. On user sign-up/register success.
  3. On the screen or page where user identity becomes known.
  4. When the user context changes (apps with multiple accounts).

User Profile

You can pass additional information associated with a user to Smartech as user attributes. These attributes can be used to segment users and target campaigns to a specific group. Attributes can also be used to send more personalized campaign messages to each user. You can use this method while Sign Up or wherever the user updates the details for its profile.

📘

Note:

  • Smartech supports following data types - String, Integer, Float, Date, Array, Objects.
  • Bool/Boolean data type in the payload is NOT supported by Smartech.
  • Date should be sent as yyyy-mm-dd format

You can use the following code to push the user's profile data.

NSDictionary *profilePushDictionary = @{@"NAME":@"Netcore Solutions", @"AGE":@"21", @"MOBILE":@"9898989898"};
[[NetCoreInstallation sharedInstance] netCoreProfilePush:@"YOUR_IDENTITY" Payload:profilePushDictionary Block:nil];
let profilePushDictionary = ["NAME": "Netcore Solutions", "AGE": "21", "MOBILE":"9898989898"]
NetCoreInstallation.sharedInstance().netCoreProfilePush("YOUR_IDENTITY", payload:profilePushDictionary, block:nil)

Identifying Users

Use the below method to set a user’s identity. In case the user’s identity is not available at the time of login, you can also use this method after the availability of identity. Once you set this identity, all corresponding events will be mapped to this identified user. The following method is used to set the Identity of the user.

📘

Note:

The Identity should be the primary key which is set in the panel.

[[NetCoreSharedManager sharedInstance] setUpIdentity:@"IDENTITY"];
NetCoreSharedManager.sharedInstance().setUpIdentity("IDENTITY")

Get Users Identity

You can use the following method to get the identity of a user.

[[NetCoreSharedManager sharedInstance] getIdentity]
NetCoreSharedManager.sharedInstance().getIdentity()

Login event

To track the login of the user via Smartech, ensure you call the Smartech SDK's login method as soon as the user logs in to the application. The following method is used for login.

[[NetCoreInstallation sharedInstance] netCorePushLogin:@"YOUR_IDENTITY" Block:nil];
NetCoreInstallation.sharedInstance().netCorePushLogin("YOUR_IDENTITY", block: nil)

Clear Identity

To clear the user's identity you need to explicitly call clearUserIdentity method. This method clears the identity and further all the events carried out after this call will be treated as Anonymous user's activity.

[[NetCoreSharedManager sharedInstance] clearIdentity];
NetCoreSharedManager.sharedInstance().clearIdentity()

Logout Event

To track logout of the user via Smartech, ensure you call the logout method named netCorePushLogout on successfully logging out the user. When you logout the user, you won't be receiving any personalized push notifications. Pass parameter value as false if you want to track user activity against its identity even if the user has logged out of the application.

[[NetCoreInstallation sharedInstance] netCorePushLogout:nil];
[[NetCoreSharedManager sharedInstance] clearIdentity];
NetCoreInstallation.sharedInstance().netCorePushLogout(nil)
NetCoreSharedManager.sharedInstance().clearIdentity()