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, for example, Product Reviewed. This event might also have some properties associated with it, like review_id and rating.
For ecommerce-specific events, refer to our Ecommerce Events Specification.

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:

FieldTypePresenceDescription
eventStringRequiredName of the user action.
propertiesObjectOptionalIncludes 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.

PropertyTypeDescription
revenueNumber

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.

currencyString

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.

valueString

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 the topics covered on this page, email us or start a conversation in our Slack community.

On this page