Tracking User
User Profile
There are cases where additional information associated with a user can be passed 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 personalize campaign messages to each user.
SmartechSDK.updateUserProfile(USER_PROFILE_DETIAL_PAYLOAD);
// Sample code for reference purpose only
const payloadata = {
NAME: "User Name",
EMAILID: "[email protected]",
AGE: "30",
MOBILE: "4545748"
};
SmartechSDK.updateUserProfile(payloadata);
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
Identifying users
Use the below method to set a user’s identity. In case the user’s identity is not available at login, you can also use this method after the availability of identity and after setting identity all corresponding events will be mapped to this identity.
SmartechSDK.setUserIdentity(USERS_IDENTITY);
Login Event
Call Smartech login method as soon as user successfully login into the app and also set user’s identity before calling the login method of SDK.
SmartechSDK.login(USERS_IDENTITY);
Clear UserIdentity
This will clear the user’s identity and after this, all activity will be tracked as anonymous.
SmartechSDK.clearUserIdentity();
Logout Event
Call Smartech logout method after user log-out from the application.
- This method would log out the user and clear identity on the Smartech backend.
- This method should be called only when the user logs out of the application
//SmartechSDK.logoutAndClearUserIdentity(isLougoutClearIdentity)
// Sample code for reference purpose only
SmartechSDK.logoutAndClearUserIdentity(1);
NOTE:
Avoid calling
clearUserIdentity()
method if one wants to track user activity even if the user has logged out of the application.
Updated about 4 years ago