Track custom events
The track function in tracker is used to cover the custom events mostly in the context of eCommerce shops like cart_updated
events etc. There are three parameters for this function:
Brevo.track(
event_name, /*mandatory*/
properties, /*optional*/
event_data /*optional*/
)
We will define the parameters for the track function here:
Attribute | Datatype | Description | Value |
---|---|---|---|
event_name | String | Corresponds to the name of your event. | var event_name = "cart_updated" |
properties | JSON object | Properties defines the state of the visitor. | var properties = { "email": "[email protected]", "FIRSTNAME": "John", "LASTNAME": "doe", } |
event_data | JSON object | A JSON object in which you can pass information about the event. | Contains id and data mentioned below |
Objects in
event_data
Some optional attributes for
event_data
are:
id:
An id is the unique identifier of an event. It can identify an object in your cart and whenever an item is added it is reflected on your Brevo account.data:
You can pass any information related to your events like the currency in which you bought the products in your cart.
An example for event_data
JSON object is mentioned below.
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"
}
]
}
}
Updated about 1 month ago