Leanplum automatically logs session and user information for you. If you want more detailed information, such as how much ad revenue you made, or how long your users played each level of your game, you can set that up with Events and States.

An event is anything that can occur in your app. Events include clicking on a link, sharing, purchasing, killing enemies, etc. All events are timestamped according to when they occur. Thus, it is not advisable to log too many (thousands) of events, as each one will have to be sent to our server.

A parameter is a piece of data associated with an event or state. You can supply parameters as a dictionary along with events and states. Here are some reports you can run with parameters:

  • Filter reports by event parameter values

  • Group metrics by distinct event parameter values (creates a bar graph + table).

    Example: Show me my top purchased items.

  • Group metrics by ranges of event parameter values (creates a histogram + table).

    Example: Show me the distribution of purchase prices.

    Example: Show me the distribution of points scored.

  • Create custom metrics for numeric parameter values, like totals and averages.

    Example: For a purchase event, track the average revenue and the amount of currency bought per user.

Parameters are not available in Developer activity analytics, but you can verify your parameters are being tracked correctly in the Debugger console.

Events and states accumulate over time, and we send events in batches periodically to minimize network usage and maximize battery life.

Tracking an Event

// User killed an enemy.

// User completed a challenge.
Leanplum.Track("Score", challengeValue);

// User liked a post.

// Or, you can supply a dictionary with up to 200 numerical or string parameters.
Dictionary<string, object> params = new Dictionary<string, object>();
Leanplum.Track("Likes", params);

// You can also pass a value and parameters.
// User made a purchase. Use Leanplum.PURCHASE_EVENT_NAME to indicate a purchase.
Dictionary<string, object> item = new Dictionary<string, object>();
params.Add("itemCategory", "Apparel");
Leanplum.Track(Leanplum.PURCHASE_EVENT_NAME, 19.99, item);

Monetization Event

To track monetization metrics, Leanplum treats your monetization event specially. By default, the event name is called "Purchase", and the value should be the revenue for the transaction in a common currency. You can change the event name from Analytics to a custom name. Simply go to the metric chooser by clicking the + tile, go to the Monetization category, and edit the purchase event. The changes will be applied retroactively.

In-App Purchases

Leanplum supports receipt validation with the App Store and Google Play. On iOS, you can track in-app purchases automatically. Simply add this line of code before Leanplum starts:



Google Play

Refer to the Android SDK documentation to track in-app purchases on Android.

To require valid receipts upon purchase or change your reported currency code from USD, update your app settings.