Tracking Event
Events are the actions performed by the user on the mobile application. Smartech SDK enables you to record these user events and later learn more about your app’s usage patterns and to segment your users, target and personalize messaging based on the events performed by them.
Predefined Events on Smartech Panel
Following is the list of Predefined events that are created on the panel which you can use if you want to:
- Page Browse
- Add To Cart
- Checkout
- Expiry Cart
- Remove From Cart
- Page Exit
- Product Search
- Product View
- Lead Submitted
- Product Purchase
- Add to Wishlist
- Remove from Wishlist
Tracking Custom Events
This method is used to track custom events which are defined by the client, to which you can analyse users' usage pattern of the product. Each event must have a name and a set of attributes describing more about the event in detail.
NetcoreSDK.track(context, "EVENT_NAME", "PAYLOAD_STRING");
// Sample code for reference purpose only
JSONObject payloadDetails = new JSONObject();
JSONObject payload = new JSONObject();
try {
payload.put("name", "Nexus 5");
payload.put("prid", 2);
payload.put("price", 15000.00);
payload.put("prqt", 1);
payloadDetails.put("payload", payload);
NetcoreSDK.track(context, "Add To Cart", payloadDetails.toString());
}
catch (JSONException e) {
e.printStackTrace();
}
NOTE:
- Smartech will automatically discover new custom activity by activity name along with payload parameters and data types.
- Smartech supports the following data types - String, Integer, Float, Date, Array, JOSNObject.
- Bool data type in payload is NOT supported by Smartech.
- Smartech will automatically convert the activity name into lowercase.
- All the payload keys must be in lower cases.
- Please provide the value of date in YYYY-MM-dd HH:mm:ss format.
Complex Event Attributes
You can send complex event attributes in an array data format. This complex event attributes will be auto-discovered on the Smartech panel and can be used while sending the campaigns.
// Sample code for reference purpose only
try{
JSONObject objProduct = new JSONObject();
JSONObject objPayload = new JSONObject();
JSONArray objProductArray = new JSONArray();
JSONObject objItem1 = new JSONObject();
objItem1.put("sku_code", "ACNF2425FDRWQRHW");
objItem1.put("prid","13456");
objItem1.put("brand", "Voltas");
objItem1.put("prname","1.5 Ton 3 Star BEE Rating 2018 Inverter AC");
objItem1.put("price", "35999.75");
objItem1.put("prqt","1");
objProductArray.put(objItem1);
JSONObject objItem2 = new JSONObject();
objItem2.put("sku_code", "TSHFFZTHF96HSW2X");
objItem2.put("prid","13457");
objItem2.put("brand", "US POLO ASSN");
objItem2.put("prname","Men V-neck Multicolor T-Shirt");
objItem2.put("price", "899.99");
objItem2.put("prqt","2");
objProductArray.put(objItem2);
objProduct.put("amount", "36899.74" );
objProduct.put("txid", "UATX123454" );
objProduct.put("currency", "INR" );
objProduct.put("delivery_date", "2017-01-09 15:00:00");
objProduct.put("products", objProductArray);
objPayload.put("payload", objProduct);
NetcoreSDK.track( this, "Product Viewed", objPayload.toString());
}
catch (Exception e) {
e.printStackTrace();
}
Updated about 4 years ago