Track

Use this API to send custom events to Heap server-side. We recommend using this for events that need to exactly match your backend, such as completed order transaction info, or events that are not available for Heap to capture on the client-side.

NOTE: It is required that you use either the identity or user_id param, but not both.

❗️

Limitations

  • Requests are limited to 30 requests per 30 seconds per identity per app_id.
  • It is required that you use either the identity or user_id param, but not both.
  • Please note: fetch, jQuery, and XMLHttpRequest options are not currently supported.
🚧

If your Heap data is in an EU datacenter, the correct endpoint is:

https://c.eu.heap-api.com/api/track (NOT heapanalytics.com)

Array property values

The properties object can contain array values. Upon ingestion, array values are converted to strings with a || delimiter. In the example below, the array is stored as the string"vanilla||chocolate||strawberry". The converted string value can be up to 1024 characters, any characters beyond this limit will be truncated.

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "app_id": "11",
    "identity": "[email protected]",
    "event": "Send Transactional Email",
    "timestamp": "2017-03-10T22:21:56+00:00",
    "properties": {
      "subject": "Welcome to My App!",
      "variation": "A",
      "flavors": ["vanilla", "chocolate", "strawberry"]
    }
  }' \
  https://heapanalytics.com/api/track

Leverage properties with custom events

We recommend naming custom events broadly and using properties to distinguish between different types of events. This makes analysis in Heap easier, and additional events can be labeled in Heap to create subsets of any broader events.

For example, if you want to send error events into Heap, we recommend:

heap.track('Error', {message: 'Authentication Failed'});

heap.track('Error', {message: 'Field Validation'});

Instead of:

heap.track('Error: Authentication Failed');

heap.track('Error: Field Validation');


Did you find what you were looking for?
Thumb up Thumb down
Language
Click Try It! to start a request and see the response here!