# Track

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`.
{{< /info >}}

{{< success >}}
For ecommerce-specific events, refer to [Ecommerce events specification]({{< ref "event-spec/ecommerce-events-spec/_index.md" >}}).
{{< /success >}}

## 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]({{< ref "event-spec/standard-events/identify.md" >}}) doc for more details.
{{< /success >}}

## Sample payload

Here is a sample payload for the `track` event after removing [Common fields]({{< ref "event-spec/standard-events/common-fields.md" >}}):

```json
{
  "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]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/_index.md" >}}) is:

```javascript
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."
})
```

## Send a sample `track` call

Use RudderStack's **Event Playground app** to send sample events to RudderStack and test the data flow without any instrumentation.

Click **Send** to see the API call in the **Network** tab of your browser's developer tools.

{{< script-app-track >}}

{{< customreadfile "/includes/send-test-events.md" >}}

## Track fields

Apart from the [Common fields]({{< ref "event-spec/standard-events/common-fields.md" >}}), 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]({{< ref "#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.

<table>
  <thead>
    <tr>
      <th style="text-align:left">
        <b>Property</b>
      </th>
      <th style="text-align:left">
        <b>Type</b>
      </th>
      <th style="text-align:left">
        <b>Description</b>
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align:left">
        <code class="inline-code">revenue</code>
      </td>
      <td style="text-align:left">Number</td>
      <td style="text-align:left">
        <p>The revenue amount as a result of an event. For e.g., a product worth $20.00 would result in a <code class="inline-code">revenue</code> of <code class="inline-code">20.00</code>.</p>
      </td>
    </tr>
    <tr>
      <td style="text-align:left">
        <code class="inline-code">currency</code>
      </td>
      <td style="text-align:left">String</td>
      <td style="text-align:left">
        <p>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.</p>
      </td>
    </tr>
    <tr>
      <td style="text-align:left">
        <code class="inline-code">value</code>
      </td>
      <td style="text-align:left">String</td>
      <td style="text-align:left">
        <p>An abstract value associated with an event, to be used by various teams.</p>
      </td>
    </tr>
  </tbody>
</table>

{{< success >}}
Different destinations recognize some of the above data points differently. You don't have to worry about these inconsistencies across destinations — RudderStack 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 [Github repo](https://github.com/rudderlabs/rudder-transformer/tree/main/src/v0/destinations/mp).
{{< /success >}}
