This endpoint is used to track a profile's activity. The following data is encoded in a JSON object. NOTE: an account can have up to 200 unique metrics (event types). This endpoint can accept payloads up to approximately 1MB.
JSON OBJECT STRUCTURE:
token: string
This is your public API key.
event: string
Name of the event you want to track.
customer_properties: JSON Object or null
Properties of the profile that triggered this event. You must identify the person by their email using a $email key (or by their phone number using a $phone_number
key if you have SMS-only contacts). Other than that, you can include any data you want and it can then be used to create segments of people. For example, if you wanted to create a list of people on trial plans, include a person's plan type in this JSON object so you can use that information later.
properties: optional; JSON Object or null
Properties of this event. Any properties included here can be used for creating segments later For example, if you track an event called "Ordered Product" you could include a property for item type (e.g. image, article, etc.), size, etc.
time: optional; 10-digit UNIX timestamp or null
When this event occurred. By default, Klaviyo assumes events happen when a request is made. If you'd like to track an event that happened in past, use this property.
SPECIAL FIELDS:
The Klaviyo CRM has the following special fields you can set for customer_properties with the Track endpoint, to unlock additional functionality:
$email: string
$first_name: string
$last_name: string
$phone_number: string; eg: "+13239169023"
$city: string
$region: string; state, or other region
$country: string
$zip: string
$image: string; url to a photo of a person
$consent: list of strings; eg: ['sms', 'email', 'web', 'directmail', 'mobile']
You can also set the following special fields in event properties with the Track endpoint:
$event_id: a unique identifier for an event
$value: a numeric value to associate with this event (e.g. the dollar value of a purchase)
EXAMPLE:
{
"token": "PUBLIC_KEY",
"event": "Ordered Product",
"customer_properties": {
"$email": "[email protected]"
},
"properties": {
"item_name": "Boots",
"$value": 100
}
}
Temporary fix for generated cURL requests on this page
Our engine that we use to generate example cURL requests on this page is currently using --data instead of --data-urlencode
If you experience any difficulties sending cURL requests, changing the data flag will resolve it.
Note: This issue is specific to just cURL requests (all other languages are functioning correctly), and just this page (our Postman Collection and OpenAPI spec, see API Overview, are up-to-date). We are actively working on a fix for this.