Track event

User event

Endpoint

POST https://api.june.so/sdk/track

Purpose

This action is used to track the identification of a user or an anonymous user.

Response

Returns a JSON response with a status of 200 and a success key set to true.

{
  "status": 200,
  "success": true
}

Parameters

Parameter Type Description Required
userId String The ID for this user in your database. Note: At least one of userId or anonymousId must be included in any track call. Optional
anonymousId String An ID associated with the user when you don’t know who they are (for example, the anonymousId generated by analytics.js). Note: You must include at least one of userId or anonymousId in all track calls. Optional
event String The name of the event you’re tracking. It is recommended to use human-readable names like Song Played or Status Updated. Required
properties Object A dictionary of properties for the event. For instance, if the event was Product Added, it might have properties like price or product. Optional
timestamp Date A JavaScript date object representing when the track took place. If the track just happened, leave it out and the server’s time will be used. If you’re importing data from the past, make sure to send a timestamp. Optional
context Object A dictionary of extra context to attach to the call. Note: context differs from traits because it is not attributes of the user itself. Optional

Example

POST https://api.june.so/sdk/track
{
  "userId": 'USER_ID',
  "event": 'Signed In',
  "properties": {
    "browser": 'chrome'
  }
}

Company event

In order to track company event, you need to pass groupId in the context object.

Example

POST https://api.june.so/sdk/track
{
  "userId": 'USER_ID',
  "event": 'Signed In',
  "properties": {
    "browser": 'chrome'
  },
  "context": {
      "groupId": "1"
  }
}