All Collections
The Track Spec
The Track Spec

This guide explains how to send events to

Updated over a week ago

The track API call is how you record any actions your users perform, along with any metadata that describe the action.

Each action is known as an event. Each event has a name, like Invoice Sent, and event metadata. For example, a Invoice Sent event might have properties like total amount and currency.

Here’s the payload of a typical track call with most common fields

{  "type": "track", 
"userId": "abc123", // Elon Musk
"event": "Invoice Sent",
"properties": {
"total amount": 123.45,
"currency" : "usd" }

And here’s the corresponding JavaScript event that would generate the above payload:

analytics.track("Invoice Sent", { 
total_amount: 123.45,
currency: "usd"

Based on the library you use, the syntax in the examples might be different. You can find library-specific documentation on the page.Sources Overview

Beyond the common fields, the track call has the following fields:







Name of the action that a user has performed.




Free-form dictionary of event metadata of the event, like total amount

Tracking events on user AND accounts!

In B2B though, most events are tracked on both user and account level. Indeed, when users can be part of different accounts, it is important to know in which account the user was active, when triggering the event.

In most B2B cases, the payload would look like this:

{  "type": "track", 
"userId": "abc123", // Elon Musk
"event": "Invoice Sent",
"properties": {
"total amount": 123.45,
"currency" : "usd" },
"context": {
"groupId" : "xyz789" } // Tesla, Inc

In most B2B cases, the appropriate JavaScript would then be:

analytics.track("Invoice Sent", { 
total_amount: 123.45,
currency: "usd"
{ groupId: "xyz789" //Tesla Inc

Full example

Here’s a complete example of a track call:

{  "anonymousId": "23adfd82-aa0f-45a7-a756-24f2a7a4c895", 
"type": "track",
"userId": "abc123", //Elon Musk
"event": "Invoice Sent",

"context": {
"groupId": "xyz789", //Tesla Inc
"library": {
"name": "analytics.js",
"version": "2.11.1" },
"page": {
"path": "/academy/",
"referrer": "",
"search": "",
"title": "Analytics Academy",
"url": "" },
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36",
"ip": "" },

"integrations": {},
"messageId": "ajs-f8ca1e4de5024d9430b3928bd8ac6b96",
"properties": {
"total amount": 123.45,
"currency": "usd" },
"receivedAt": "2015-12-12T19:11:01.266Z",
"sentAt": "2015-12-12T19:11:01.169Z",
"timestamp": "2015-12-12T19:11:01.249Z",
"originalTimestamp": "2015-12-12T19:11:01.152Z"


The User ID is a unique identifier for the user performing the actions. Check out the User ID docs for more detail.

The Anonymous ID can be any pseudo-unique identifier, for cases where you don’t know who the user is, but you still want to tie them to an event. Check out the Anonymous ID docs for more detail.

Note: In our browser and mobile libraries a User ID is automatically added from the state stored by a previous identify call, so you do not need to add it yourself. They will also automatically handle Anonymous IDs under the covers.


Every track call records a single user action. calls these “events”, and recommend that you make your event names human-readable, so that everyone on your team (even you, after all that caffeine) can know what they mean instantly.

Don’t use nondescript names like Event 12 or TMDropd. Instead, use unique but recognizable names like Video Recorded and Order Completed. recommends event names built from a noun and past-tense verb.

Event Metadata

Event Metadata are extra pieces of information you can tie to events you track. They can be anything that will be useful while analyzing the events later. recommends sending event metadata whenever possible because they give you a more complete picture of what your users are doing.

Note: You might be used to some destinations recognizing special properties differently. For example, Mixpanel has a special track_charges method for accepting revenue. Luckily, you don’t have to worry about those inconsistencies. Just pass along revenue.

Did this answer your question?