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:
- 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 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"];
[[Smartech sharedInstance] trackEvent:@"Product Viewed" andPayload:payloadDict];
let payloadDict = [
"product_id" : "1329",
"product_name" : "T-shirt",
"brand" : "Polo"]
Smartech.sharedInstance().trackEvent("Product Viewed", andPayload: payloadDict)
Note:
- Smartech will automatically discover new activity by activity name along with payload parameters and data types.
- Smartech supports the following data types - String, Integer, Float, Date, Array, Dictionary.
- The bool data type in the payload is not supported by Smartech.
- Please provide the value of the date in YYYY-MM-dd HH:mm:ss format.
- 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"];
[[Smartech sharedInstance] trackEvent:@"Add to cart" andPayload:payloadDictWithArray];
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
Smartech.sharedInstance().trackEvent("Add to cart", andPayload:payloadDictWithArray)
Updated over 4 years ago