Leanplum automatically logs some session and user information for you. To track 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 up Events and States.
One of the most important parts of the onboarding process is deciding what to track in Leanplum.
Be sure to review our API Limits policy to see how many events, states, parameters, and user attributes you can track with Leanplum per app (and per user session), as well as our naming guidelines for user attributes and variables.
An event is anything that can occur in your app. Events include clicking on a link, sharing, purchasing, killing enemies, etc. All events you track with Leanplum are automatically timestamped to capture when they occur.
Focus on core user activities your app is trying to drive, then track those and any related activities with events. For example, you might want to track multiple events along your user onboarding and conversion/purchase flows, like an Add to cart event, or an Onboarding complete event.
The following should each be separate events:
- Add To Cart
- Rate Item
As a general best practice, each step in a funnel should have its own event name.
You can only have 500 events at any given time in Leanplum. Reduce the number of unique events by using parameters.
Event parameters cannot be used as target criteria (e.g. Send a message to users with event with X parameter), though you can use event parameter changes to trigger a message to send. Only Events and User attributes can be used as targeting criteria for messages and tests.
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. Parameters are great for adding contextual information about an event, e.g. price for the purchased items or destination city for a booked flight. This information can then be used to personalize message content, and to run contextual reports for deep analysis on specific groups of users.
Parameters can either be numeric (for example, “number of items ordered”) or string. If marked as numeric, Leanplum will compute averages and sums for that parameter.
Leanplum.track("Open App Test Bank") Leanplum.track("Open App Blink Books")
Leanplum.track("Open App", withParameters:["app_name": "Test Bank"]) Leanplum.track("Open App", withParameters:["app_name": "Blink Books"]) // OR better yet Leanplum.track("Open App", withParameters:["app_name": "Blink TV", "category": "Featured", "page": "Entertainment"])
A state is any part of your app a user can be in. For example, some states can include being in a particular level, watching a video, or browsing an in-app store. All states have a time and a duration, which is set automatically -- when one state begins, the previous one ends.
Identify the core areas in your app. Focus on key screens in your app that you'd like to monitor, then track those as states. Leanplum also has the option to automatically track all screens in your app as states.
Do not use the same name to track a state and an event
Having the same name for two different events and states can cause problems in your dashboard. Make sure all of your event and state names are descriptive and unique to one another.
A user attribute is any piece of data associated with a user that you provide to the SDK
Intended to store user data that is persistent throughout a session, and to get copied from one session to the next.
Examples of user attributes include:
- Number of friends
- User interests
- Up to 200 attributes per app
- Attribute names must be strings, and values must be strings or numbers
- Attribute values will be the same across all events and states in a particular session
Configure your Variables and File Variables to represent what you want to be able to change remotely.
Here are some common use cases for the different types of variables:
- Turning features on or off (boolean)
- Changing configurations (string)
- Changing display text (string)
- Ordering of elements (array/dictionary)
- Complex configurations (array/dictionary)
Updated 2 months ago