Skip to main content

Track Event

Track a custom event for a subscriber. This is used to trigger workflows that listen for the specified event name.

POST
 https://s2s.pushengage.com/api/v1/events

Headers

HeaderValueRequired
Api-KeyYour API keyYes
Content-Typeapplication/jsonYes

Request Body

Property NameTypeRequiredDescription
event_nameStringYesName of the custom event. Max 64 characters. Must not start with "PushEngage.".
device_token_hashStringConditionalSubscriber's device token hash. Required if profile_id is not provided.
profile_idStringConditionalSubscriber's profile ID. Required if device_token_hash is not provided. If both are provided, profile_id takes priority.
dataObjectNoKey-value pairs sent with the event. Keys must start with a letter or digit and can contain letters, digits, hyphens, and underscores (max 255 chars). Values must be string, number, boolean, or ISO 8601 date. Max payload size: 4KB.

Example

Request

curl -X POST https://s2s.pushengage.com/api/v1/events \
-H "Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"event_name": "add_to_cart",
"device_token_hash": "DEVICE_TOKEN_HASH",
"profile_id": "PROFILE_ID",
"data": {
"product_name": "Running Shoes",
"price": 99.99
}
}'

Response

{
"error_code": 0,
"data": {}
}

Notes

  • You must provide either device_token_hash or profile_id. If both are provided, profile_id takes priority.
  • The data payload is limited to 4KB.
  • Event data values must be string, number, boolean, or ISO 8601 date.
  • For client-side event tracking (from the browser), use the Web SDK's PushEngage.trackEvent() method instead.