Feature Experimentation API

Sending Events/Goals (Track)

The purpose of the /track endpoint is to register events/goals for the user. This can be used to measure how well a feature or a specific variation works.

On this page

Introduction to the use

There are three general types of events:

  • pageview represents a call to a views/page
  • click represents a click of the user on a specific element
  • custom is an event of any other type. Here it is possible to specify values (value) in addition to the actual triggering (conversion)

A pageview event is implicitly provided by default with every decide call.

Payload of a /track request

https://fe-api.ablyft.com/v1/track
HTTP method POST
Headers
  • Accept: application/json
  • Authorization: Bearer [token]
Body (JSON)
  • user
    • bucketing object required

      Representation of the current user bucket (experiments in which the user is already in / analogous to the client-side cookie ablyft_exps).

  • events array
    • event object
      • id integer required

        ID created by the platform.

      • type string required

        Type of the goal/event created in the platform.

      • value integer or float

        If the value for the goal/event is to be counted (instead of treating it as a conversion).

{
    user: {
        bucketing: {
            "12345678": 87654321,
            "87654321": 12345678
        }
    },
    events: [
        {
            id: 45645645,
            type: "custom",
            value: 123.34
        }
    ]
}

Understanding the response

A request has an empty response body.

HTTP response status codes

204OKThe request succeeded (no content)
400Bad RequestError in request, only JSON is valid
401UnauthorizedAPI token denied
405Method Not AllowedOnly HTTPS and POST is valid
429Too Many RequestsThe rate limit was reached
500Internal Server ErrorAny other internal error