Spec: Track
Last updated
Last updated
The track
API call is how you record any actions your users perform, along with any properties that describe the action.
Each action is known as an event. Each event has a name, like User Registered, and properties. For example, a User Registered event might have properties like plan
or accountType
. Calling track
in one of our sources is one of the first steps to getting started with Innkeepr.
Here’s the payload of a typical track
call with most common fields removed:
And here’s the corresponding JavaScript event that would generate the above payload:
Beyond the common fields, the track
call has the following fields:
event
required
String
properties
optional
Object
Here’s a complete example of a track
call:
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. We call 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.
We recommend event names built from a noun and past-tense verb.
Properties 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. We recommend sending properties whenever possible because they give you a more complete picture of what your users are doing.
Innkeepr has reserved some properties that have semantic meanings, and handle them in special ways. For example, we always expect revenue
to be a euro amount that we send to tools that handle revenue tracking.
You should only use reserved properties for their intended meaning.
The following are all of the reserved properties Innkeepr has standardized that apply to all events. Check out the Semantic Events docs for properties specific to individual reserved events.
PROPERTY
TYPE
DESCRIPTION
revenue
Number
Amount of revenue an event resulted in. This should be a decimal value, so a shirt worth €19.99 would result in a revenue
of 19.99
.
currency
String
value
Number
An abstract “value” to associate with an event. This is typically used in situations where the event doesn’t generate real-dollar revenue, but has an intrinsic value to a marketing team, like newsletter signups.
Name of the action that a user has performed. See the for more details.
Free-form dictionary of properties of the event, like revenue
See the for a list of reserved property names.
Currency of the revenue an event resulted in. This should be sent in the . If this isn’t set, Innkeepr assumes the revenue to be in euros.