The Track Spec
100% compatible with Segment
These specs are 100% compatible with http://segment.com specs.
Topics
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:
FIELD | REQUIRED? | TYPE | DESCRIPTION |
| required | String | Name of the action that a user has performed. |
| optional | Object | Free-form dictionary of event metadata of the event, like |
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:
Example
Here’s a complete example of a track
call:
Identities
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.
Event
Every track
call records a single user action. journy.io 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.
journy.io 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. journy.io 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
.