Track custom events
Legacy Tracker Documentation
For the legacy tracker doc, check our guide here.
Custom events are events that you would like to follow. We call them custom in the sense that you are able to give it any name you want.
You can use it in different situations, for example in the context of an eCommerce shop, to follow cart events. Here is the syntax:
Brevo.push([
"track",
event_name, /* mandatory */
properties, /* optional */
event_data /* optional */
]);
Parameters are defined below:
Attribute | Datatype | Description | Value |
---|---|---|---|
event_name | String | Name of your event | "cart_updated" |
properties | JSON object | Describes the state of the visitor | {"email": "[email protected]","FIRSTNAME": "John","LASTNAME": "doe"} |
event_data | JSON object | A JSON object which you can use to pass information about the event | See example below |
Here is an example for event_data
:
event_data = {
"id": "cart:1234",
"data": {
"total": 280,
"currency": "USD",
"url": "www.example.com",
"items": [{
"name": "Black shoes",
"price": 90,
"quantity": 2,
"url": "www.example.com/black-shoes",
"image": "www.example.com/black-shoes.jpg"
}
]
}
}
Example
var event_name = "cart_updated";
var properties = {
"email": "[email protected]",
"FIRSTNAME": "John",
"LASTNAME": "doe"
}
var event_data = {
"id": "cart:1234",
"data": {
"total": 280,
"currency": "USD",
"url": "www.example.com",
"items": [{
"name": "Black shoes",
"price": 90,
"quantity": 2,
"url": "www.example.com/black-shoes",
"image": "www.example.com/black-shoes.jpg"
}
]
}
}
Brevo.push([
"track",
event_name, /* mandatory */
properties, /* optional */
event_data /* optional */
]);
Updated 16 days ago
What’s Next