Tracking Analytics data via API

In order to send a message that is triggered from an event coming from your server, you will need to track the data via an API call in Leanplum. For example, if a user completes a purchase from your store, you may want to track an event that includes the estimated arrival time as the parameter. To ensure proper handling of time zones, use ISO 8601 format for all date/time parameters.

For example, on the iOS SDK:

[Leanplum track:@"PurchaseBook" withParameters:@{@"ArrivalDateTime": @"2015-08-10T21:50:00+00:00", @"BookTitle": @”Emma"}];

And here is the equivalent for the REST API:

https://www.leanplum.com/api?appId=YOUR_APP_ID&clientKey=YOUR_CLIENT_KEY&action=track&apiVersion=1.0.6&userId=USER_ID&event=PurchaseBook&params={"ArrivalDateTime":"2015-08-10T13:30:00+00:00","BookTitle": "Emma"}&allowOffline=true

And then you can configure your messaging campaign as follows:



This will send the push at 2015-08-09 13:30 (exactly 1 day before the ArrivalDateTime parameter).


Was this article helpful?
Have more questions? Submit a request