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

Event Tracking

Events are all the actions performed by the user on the mobile application. Smartech SDK enables you to record 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:

  1. Page Browse
  2. Add To Cart
  3. Checkout
  4. Expiry Cart
  5. Remove From Cart
  6. Page Exit
  7. Product Search
  8. Product View
  9. Lead Submitted
  10. Product Purchase
  11. Add to Wishlist
  12. Remove from Wishlist

Tracking Custom Events

This method is used to track custom events which are defined by the client, to which you can analyze users usage pattern of the product. Each event must have a name and a set of attributes describing more about the event in detail.

NSMutableDictionary *payloadDict = [NSMutableDictionary new];
[payloadDict setObject:@"1329" forKey:@"product_id"];
[payloadDict setObject:@"T-shirt" forKey:@"product_name"];
[payloadDict setObject:@"Polo" forKey:@"brand"];
        
[[NetCoreAppTracking sharedInstance] trackEventWithCustomPayload:@"Product Viewed" Payload:payloadDict Block:nil];
let payloadDict = NSMutableDictionary()
payloadDict["product_id"] = "1329"
payloadDict["product_name"] = "T-shirt"
payloadDict["brand"] = "Polo"

NetCoreAppTracking.sharedInstance()?.trackEvent(withCustomPayload: "Product Viewed", payload: payloadDict, block: nil)

📘

Note:

  1. Smartech will automatically discover new activity by activity name along with payload parameters and data types.
  2. Smartech supports the following data types - String, Integer, Float, Date, Array, Dictionary.
  3. The bool data type in the payload is not supported by Smartech.
  4. Please provide the value of the date in YYYY-MM-dd HH:mm:ss format.
  5. All the payload keys must be in lower cases.

Complex event attributes

You can send complex event attributes with the combination of NSArray and NSDictionary data types. This complex event attributes will be auto-discovered on the Smartech panel and can be used to send campaigns.

NSMutableDictionary *payloadDictWithArray = [NSMutableDictionary new];
[payloadDictWithArray setObject:@"36899.74" forKey:@"amount"];
[payloadDictWithArray setObject:@"UATX123454" forKey:@"txid"];
[payloadDictWithArray setObject:@"INR" forKey:@"currency"];

NSMutableDictionary *item1Dictionary = [NSMutableDictionary new];
[item1Dictionary setObject:@"13456" forKey:@"prid"];
[item1Dictionary setObject:@"1.5 Ton 3 Star BEE Rating 2018 Inverter AC" forKey:@"prname"];
[item1Dictionary setObject:@"35999.75" forKey:@"price"];
[item1Dictionary setObject:@"1" forKey:@"prqt"];
        
NSMutableDictionary *item2Dictionary = [NSMutableDictionary new];
[item1Dictionary setObject:@"13456" forKey:@"prid"];
[item2Dictionary setObject:@"Men V-neck Multicolor T-Shirt" forKey:@"prname"];
[item2Dictionary setObject:@"899.99" forKey:@"price"];
[item2Dictionary setObject:@"2" forKey:@"prqt"];
        
NSArray *itemsArray = [[NSArray alloc] initWithObjects:item1Dictionary, item2Dictionary,nil];
[payloadDictWithArray setObject:itemsArray forKey:@"items"];
        
[[NetCoreAppTracking sharedInstance] trackEventWithCustomPayload:@"Add to cart" Payload:payloadDictWithArray Block:nil];
let payloadDictWithArray = NSMutableDictionary()
payloadDictWithArray["Amount"] = "36899.74"
payloadDictWithArray["txid"] = "UATX123454"
payloadDictWithArray["Currency"] = "INR"

let item1Dictionary = NSMutableDictionary()
item1Dictionary["SKU Code"] = "ACNF2425FDRWQRHW"
item1Dictionary["prid"] = "13456"
item1Dictionary["prname"] = "1.5 Ton 3 Star BEE Rating 2018 Inverter AC"
item1Dictionary["Price"] = "35999.75"
item1Dictionary["prqt"] = "1"

let item2Dictionary = NSMutableDictionary()
item2Dictionary["SKU Code"] = "TSHFFZTHF96HSW2X"
item2Dictionary["prname"] = "Men V-neck Multicolor T-Shirt"
item2Dictionary["Price"] = "899.99"
item2Dictionary["prqt"] = "2"

let itemsArray = [item1Dictionary, item2Dictionary]
payloadDictWithArray["items"] = itemsArray

NetCoreAppTracking.sharedInstance()?.trackEvent(withCustomPayload: "Add to cart", payload: payloadDictWithArray, block: nil)