The Iterable mobile SDK can track user events as a way to record a specific action at a given time.
NOTES
Iterable does not currently charge for track calls but we still encourage our customers to only track relevant and actionable events within the platform in order to reduce noise and focus on important milestones for your user.
Table of contents
Custom event names
It is better not to include spaces in your custom event names, because it
requires extra handlebar logic within the plaform. For example, when a user
signs up, you will likely want to define it as signUp
or signs_up
but not
Signs Up
.
Tracking custom events
Most events tracked within Iterable will be unique to your business and distinct use case. Below are some examples of how to structure your custom events.
Swift
IterableAPI.track(event: "Custom_event", dataFields: ["key": "value"])
Java
IterableApi.getInstance().track("Custom_event", datafields);
Tracking purchase events
Iterable has a dedicated endpoint for tracking purchases. It is recommended to use this call to enable Iterable to better track purchase analytics and attribution. There are 2 ways to track purchases in the Iterable SDK.
NOTES
The SDK by default will track campaign ID and Template ID. For more information on setting up attribution from email, please visit our deep linking section.
Swift
// Example price field let price_from_app: NSNumber = 4.99 //Create an array of commerce Items let items_from_app = [CommerceItem(id: "String", name: "String", price: 4.99, quantity: 1)] // Iterable Track Call IterableAPI.track(purchase: price_from_app, items: items_from_app)
Java
Double total = new Double(4.99); List<CommerceItem> items = new ArrayList<CommerceItem>(); items.add(new CommerceItem("String", "String", 4.99, 1)); IterableApi.getInstance().trackPurchase(total, items);
Tracking purchase event metadata
You can include datafields (also known as metadata) in the track purchase call as well. This can be any data that you would like to leverage in future campaigns.
Swift
// Example data fields let dataField : [String: Any] = [ "Store_Address":[ "Street1": "123 Main St", "Street2": "Apt 1", "City": "Iter-a-ville", "State": "Ca", "Zip": "90210" ] ] // Example price field let price_from_app: NSNumber = 4.99 //Create an array of commerce Items let items_from_app = [CommerceItem(id: "String", name: "String", price: 4.99, quantity: 1)] // Iterable Track Call trackPurchase(price_from_app, items: items_from_app, dataFields: dataField)
Java
JSONObject store_address = new JSONObject(); final JSONObject datafields = new JSONObject(); try { store_address.put("Street1", "123 Main St"); store_address.put("Street2", "Apt 1"); store_address.put("City", "Iter-a-ville"); store_address.put("State", "CA"); store_address.put("Zip", "90210"); datafields.put("dataFields", address); } catch (JSONException e) { e.printStackTrace(); } Double total = new Double(4.99); List<CommerceItem> items = new ArrayList<CommerceItem>(); items.add(new CommerceItem("String", "String", 4.99, 1)); IterableApi.getInstance().trackPurchase(total, items, datafields);
Comments
0 comments
Article is closed for comments.