Track

Get started with the RudderStack Track API call.

The track call lets you record the user’s actions along with any properties associated with them.

info
Each user action is called an event. Every event has a name associated with it, for example, Product Reviewed. This event can have properties associated with it, like review_id and rating.
success
For ecommerce-specific events, refer to Ecommerce events specification.

Event Names

It is recommended that events have a descriptive human readable name. This allows everyone (include you 6 months from now) to instantly understand the meaning of an event.

Vague or abstract names like ProdRV and Event2 should be avoided. Instead focus on unique unabiguous names like Product Reviewed and Order Submitted. A common framework is to use nouns and past tense verbs.

success

Identity data (user traits) will be automatically added to track calls from the most recent identify call, so you do not need to add it manually. This information will be included in a traits object in the context fields of the payload. Note that track calls also automatically handle anonymousId values associated with the user.

See our Identify doc for more details.

Sample payload

Here is a sample payload for the track event after removing Common fields:

{
  "type": "track",
  "event": "Product Reviewed",
  "properties": {
    "review_id": "86ac1cd43",
    "product_id" : "9578257311",
    "rating" : 3.0,
    "review_body" : "OK for the price. It works but the material feels flimsy."
  }
}

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

rudderanalytics.track("Product Reviewed", {
  review_id: "86ac1cd43",
  product_id: "9578257311",
  rating: 3.0,
  review_body: "OK for the price. It works but the material feels flimsy."
})

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.

success

Different destinations recognize some of the above data points differently.

With RudderStack, you don’t have to worry about these inconsistencies across destinations. Our open source destination transformer code handles these destination-specific conversions automatically.

For example, Mixpanel has a track_charges method for tracking revenue. In this case, you can pass the revenue property and RudderStack will handle the conversion automatically through our destination transformer code. You can see the Mixpanel transformer code in our open source Github repo.


Questions? Contact us by email or on Slack