track

Tracks one occurrence of an event for a user. If the user/device does not exist, a new user will be created (see the createDisposition option below). This method requires your production API clientKey. See tracking events via API for examples.

Body Params
string
required
Defaults to YOUR_APP_ID

The application ID. To find yours, select your app in the navigation column, and click Manage Apps. Then click Keys & Settings.

string
required
Defaults to YOUR_PROD_KEY

The Production key for your Leanplum App.

string
enum
required
Defaults to 1.0.6

The version of the Leanplum API to use. The current version is 1.0.6.

Allowed:
string
required
Defaults to hfarnsworth

The current user ID. You can set this to whatever your company uses for user IDs. Leave it blank to use the device ID. For more info, see selecting a user.

string

A unique ID for the device targeted by the request. You must provide a deviceId and/or a userId. See selecting a user.

boolean
Defaults to false

Whether the user is in Development Mode, i.e. the user associated with the request is a developer and not a user. This is important for reporting purposes. Default: false.

string
enum
Defaults to CreateIfNeeded

The policy that determines whether users are created by the API. Possible values:

  • CreateIfNeeded creates a user with the given IDs if one does not already exist.
  • CreateNever requires that the user already exists, otherwise the API action is skipped and a warning will be returned.

The default value for this method is CreateIfNeeded.

Allowed:
string
required

The name of the event. Use "Purchase" to identify a monetization event, with the event value being the revenue. You can change the default monetization event name in Analytics by going to the metric chooser and clicking the Monetization metric category.

float

The event value. For example, for a purchase event, this would be the purchase price.

string

The ISO 4217 currency code associated with value. Leanplum will automatically convert value into your preferred currency, while retaining the original price and currency code as event parameters localCurrency and localPrice. Currency conversion rates are updated every hour.

string

Any info attached to the event.

float

Option to provide the UNIX timestamp for when the event occurred, which may be different from the current time.

string

A flat object of parameters as key-value pairs. Each key must be a string, and up to 50 parameters may be set. Example: {"gender":"F","age":21}.

number

The message ID this event is associated with. Set this to track a user's interaction with a message. To track a message Send or a View, set the event argument to an empty string. For other interactions, set the event argument to the type of action (example values include Open, Cancel, Accept). The Leanplum SDK does this automatically, so this should be used for advanced use cases only.

string
enum

Determines how tracked events affect sessions and user activity. If present, disposition must have one of the following values:

  • active (default): Used for events reflect user activity. Active events should mark the user as active, and should be tracked within a session. (Replaces the deprecated option allowOffline: false.)
  • passive: Used for events that do not correspond to user activity. These events do not need to occur within a session, and do not mark a user as active. For example, sending a user a message would be tracked passively, since it affects a user, but does not represent user activity. (Replaces the deprecated option allowOffline: true.)
  • requireActive: Used for events that must only be tracked within a session. These events are rejected, and return a warning response with ignored: true if the user does not have an active session. Clients should detect the warning by the ignored field, as warning messages may change.
Allowed:
Response

Language
Credentials
URL
Response
Choose an example:
application/json