Event API allows you to track the actions of a user.
API Endpoint
POST https://api-0X.moengage.com/v1/event/<APP_ID>
Each customer is hosted on a different data center, you can find your data center number (value of X), by checking the data center and API endpoint mapping page here.
APP_IDThe APP_ID for your MoEngage account is available on the MoEngage Dashboard in Settings > App Settings > Account Settings > APP ID. |
Request Body
Request Body Fields
Key | Datatype | Required | Description |
---|---|---|---|
type | String | Yes | Identify the type of request. |
customer_id | String | Yes | Identifier to identify or create a user in MoEngage. |
device_id | String | No | device_id in event payload is optional. The default value is the customer_id value. The value is used to map events to specific devices. |
actions | List | Yes | List of events to be tracked for the user. |
action | String | Yes | The name of the event to be tracked. |
attributes | JSON Object | No | A dictionary containing event attributes to track with the event. |
platform | String | No | Used to identify the platform on which the event happened. Allowed values are ANDROID, iOS, web, or unknown. |
app_version | String | No | App Version of the app on which the event originated. |
user_time | Numeric(Epoch time in seconds) or String (ISO 8601 - ) | No | Local Time at which the event happened. |
current_time | Numeric (Epoch time in seconds) or String( ISO 8601) | No | UTC Time at which the event happened |
user_timezone_offset | Numeric | No | user_timezone_offset should have a value in seconds which can be between -54000 to 54000. For example, for IST (UTC+0530), "user_timezone_offset" will be 19800 |
PlatformEnsure that the platform value sent is Android, iOS, or web. Platform value depends on which platform the event was generated. |
Time of the eventMoEngage depends on current_time and user_timezone_offset for generating the local time at which the event occurred. The local time is displayed in the user profile on the dashboard.
|
Example Payload
The following example provides tracking of numeric, boolean, and date type event attributes.
Use the payload described, where the price is numeric, departure_date is a date type attribute and premium_seat is a boolean attribute.
{
"type": "event",
"customer_id": "john@example.com",
"actions": [{
"action": "Flight Bookoed",
"attributes": {
"price": 3999,
"departure_date": "2019-05-21T03:47:35Z",
"premium_seat": true
},
"platform": "iOS",
"app_version": "1.2.3",
"current_time": 1433837969,
"user_timezone_offset": 19800
}
]
}