User & Event Tracking
Netcore CE SDK allows you to track user behavior and build rich user profiles which then can be used to create segments & target them with personalized communication.
Here is the reference for the Sample Events Sheet by business vertical
Based on your use cases, please follow the steps to get started with user tracking and events tracking.
Please ensure that you have done base SDK integration
User Tracking
1. Building User Profile
You can pass additional information associated with a user to Smartech as user attributes as shown below.
const payloadata =
{
FIRST_NAME: "",
LAST_NAME: "",
AGE: "",
COUNTRY: "",
STATE: "",
CITY: "",
PINCODE: ""
};
SmartechBaseReact.updateUserProfile(payloadata, function (response) {
}, function (error) {
});
Note
- Smartech supports following data types - String, Integer, Float, Date.
- Date should be sent as yyyy-mm-dd format
2. 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 identity is available.
SmartechBaseReact.setUserIdentity("<USER'S_IDENTITY>",(error, result) => {
})
3. 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.
SmartechBaseReact.login(<USER'S_IDENTITY>);
4. Clear Identity
This will clear the user’s identity and after this, all activity will be tracked as anonymous.
SmartechBaseReact.clearUserIdentity();
5. Logout Event
Call the Smartech logout method after the user log-out from the application. If you want to clear the user identity pass true in the parameter. When you logout the user with identity clear, you won't be receiving any personalized push notifications
SmartechBaseReact.logoutAndClearUserIdentity(false);
Installation Event Tracking
Custom Event Tracking
This method is used to track custom events that are defined by the client, to which you can analyze users' usage patterns of the product. Each event must have a name and a set of attributes describing more about the event in detail.
SmartechBaseReact.trackEvent("EVENT_NAME", "PAYLOAD_STRING");
// Sample code for reference purpose only
const payloadata = {
name: "Galaxy",
description: "20gram bars",
payload_id: "1",
event_id:21
};
SmartechBaseReact.trackEvent("Page Browse", payloadata);
Location Tracking
You can track user's location or set it yourself by following the below steps.
SmartechBaseReact.setUserLocation(LATITUDE_DOUBLE_VALUE, LONGITUDE_DOUBLE_VALUE);
// Sample code for reference purpose only
SmartechBaseReact.setUserLocation(19.0760, 72.8777);
GDPR Opt-in & Opt-out
Opt for Tracking
To opt-out of tracking, call the optTracking()
method by passing false
value. Once you have opted out of tracking you need to explicitly opt-in, until opted in no communication will happen with the panel. To opt-in for tracking, call the optTracking()
method by passing true
value.
var booleanOpt = false/true
SmartechBaseReact.optTracking(booleanOpt)
//To check the current consent status for tracking, call the following method
SmartechBaseReact.hasOptedTracking(function(status) {
})
Opt For Push Notifications
Netcore CE SDK has optPushNotification() method to opt-in or opt-out for Push Notifications sent from the panel.
Passing false in the parameter will opt-out for Push Notifications. For opt-in pass true in the parameter.
var booleanOpt = false/true
SmartechPushReact.optPushNotification(booleanOpt)
//To check the current consent status for push notification, call the following method
SmartechPushReact.hasOptedPushNotification(function(status) {
})
Opt For In-App Messages
var booleanOpt = false/true
SmartechBaseReact.optInAppMessage(booleanOpt)
//To check the current consent status for In-App Message, call the following method
SmartechBaseReact.hasOptedInAppMessage(function(status) {
})
Updated 2 months ago