Use the following method when the user purchases one or more items:
Objective-C
NSMutableDictionary *properties = [[NSMutableDictionary alloc] init]; [properties setObject:@"Order ID" forKey:@"OM.tid"]; [properties setObject:@"Product1 Code;Product2 Code" forKey:@"OM.pp"]; [properties setObject:@"Product1 Quantity;Product2 Quantity" forKey:@"OM.pu"]; [properties setObject:@"Product1 Price*Product1 Quantity;Product2 Price*Product2 Quantity" forKey:@"OM.ppr"]; [properties setObject:@"memberID/userID" forKey:@"OM.exVisitorID"]; [properties setObject:@"Token ID to use for push messages" forKey:@"OM.sys.TokenID"]; [properties setObject:@"App ID to use for push messages" forKey:@"OM.sys.AppID"]; [[Visilabs callAPI] customEvent:@"Purchase" withProperties:properties];
Swift
var properties = [String:String]() properties["OM.tid"] ="Order ID" properties["OM.pp"] = "Product1 Code;Product2 Code" properties["OM.pu"] = "Product1 Quantity;Product2 Quantity" properties["OM.ppr"] = "Product1 Price*Product1 Quantity;Product2 Price*Product2 Quantity" properties["OM.exVisitorID"] = "memberID/userID" properties["OM.sys.TokenID"] = "Token ID to use for push messages" properties["OM.sys.AppID"] = "App ID to use for push messages" Visilabs.callAPI().customEvent("Purchase", withProperties: NSMutableDictionary(dictionary: properties))
TokenID and AppID parameters are optional.
Please do not forget to use a universalID/customerID as the user ID which you also share with other parties such as ESP. If you are using GSM number or email address instead of a userID please send that info as user ID and make sure that you share the same ID with other parties.
Do not use thousands separator when sending numbers. Wrong: 123.456,78 Correct: 123456,78
While sending category codes and names do not forget to include the full hierarchy starting from top category to lowest level sub-category such as computers|portable computers|laptops. Use pipe "|" to separate different levels of categories.