Tracking events using the Waitlyst API

In some cases, a company can choose to send events directly to the API instead of using waitlyst.js. This approach is especially useful if there is custom setup for handling user events.

All requests to the Waitlyst API must be made over HTTPS and include a Publishable Key sent in the Authorization: "Bearer key" headers. The API is available at:

https://api.waitlyst.co/v1/events/process/

Event payload

The base event payload is a JSON object with the following properties:

{
    anonymousId: "<unique-id-generated-for-this-user>",
    messageId: "<unique-id-for-this-event>",
    receivedAt: "2022-10-09T02:49:54.139Z",
    sentAt: "2022-10-09T02:49:54.139Z",
    timestamp: "2022-10-09T02:49:54.139Z",
    type: "track",
    userId: "user-id",
}

Track event

The track event is used to track any user action. It is the most common event type.

{
    anonymousId: "<unique-id-generated-for-this-user>",
    messageId: "<unique-id-for-this-event>",
    timestamp: "2022-10-09T02:49:54.139Z",
    type: "track",
    userId: "user-id",
    event: "signup",
    properties: {
        userId: '123'
    }
}

Page event

The page event is used to track page views. It is automatically sent by waitlyst.js - however for node applications, you will need to send this event manually.

{
    anonymousId: "<unique-id-generated-for-this-user>",
    messageId: "<unique-id-for-this-event>",
    timestamp: "2022-10-09T02:49:54.139Z",
    type: "page",
    userId: "user-id",
    properties: {
        "title": "Home",
        "url": "https://example.com",
        "path": "/",
        "hash": "",
        "search": "",
        "width": 687,
        "height": 883
    }
}

Identify event

The identify event is used to associate a user with their actions and record traits about them.

{
    anonymousId: "<unique-id-generated-for-this-user>",
    messageId: "<unique-id-for-this-event>",
    timestamp: "2022-10-09T02:49:54.139Z",
    type: "identify",
    userId: "user-id",
    traits: {
        "email": "test@example.com"
    }
}

Error messages

If the API returns an error, the response body will contain an error message.

The following error messages are possible:

  • HTTP 401: API Key must be provided.
  • HTTP 403: Invalid API Key. This is usually a key that has been expired or you mistakenly sent a Secret key instead a Publishable Key.
  • HTTP 400: No enabled Analytics workspace is connected
  • HTTP 400: Invalid event payload
  • HTTP 400: Missing userId or anonymousId