Track

Detailed technical description of the Track API call.

The track call lets you record the customer events, i.e. the actions that they perform, along with any properties associated with them.

Each user action is called an event. Every event has a name associated with it, e.g. Product Reviewed. This event might also have some properties associated with it, like review_id and rating.

For E-Commerce specific events, refer to our E-Commerce Events Specification guide.

Sample payload

A sample payload for the track event after removing the common fields mentioned in the Common Fields section is as shown:

{
  "type": "track",
  "event": "Product Reviewed",
  "properties": {
    "review_id": "12345",
    "product_id" : "123",
    "rating" : 3.0,
    "review_body" : "Average product, expected much more."
  }
}

The corresponding event that generates the above payload via the JavaScript SDK is as shown:

rudderanalytics.track("Product Reviewed", {
  review_id: "12345",
  product_id: "123",
  rating: 3.0,
  review_body: "Average product, expected much more."
})

Track fields

Apart from the Common Fields, the track call accepts the following fields:

Field

Type

Presence

Description

event

String

Required

Name of the user action.

properties

Object

Optional

Includes the properties associated with the event. For more information, check the Properties section below.

Properties

Properties are additional contextual information that are associated with a track event, that give more clarity of your users' actions.

RudderStack has reserved some standard properties listed in the following table and handles them in a special manner.

Property

Type

Description

revenue

Number

The revenue amount as a result of an event. For e.g., a product worth $20.00 would result in a revenue of 20.00.

currency

String

The currency of the revenue as a result of the event, set in ISO 4127 format. If this is not set, RudderStack assumes the revenue is in USD.

value

String

An abstract value associated with an event, to be used by various teams.

Different destinations recognize some of the above traits differently. For example, Mixpanel has a track_charges method for tracking revenue. With RudderStack, you don't have to worry about these inconsistencies. In this case, you can pass the revenue property and RudderStack will handle the conversion automatically.

Contact us

For more information on any of the sections covered in this doc, you can contact us or start a conversation in our Slack community.

Last updated