Track custom events
For the REST implementation, you can use the endpoint https://in-automate.brevo.com/api/v2/trackEvent
with the POST
method. This endpoint lets you to capture events and additional information about the events. A cURL request is mentioned below.
curl --request POST \
--url https://in-automate.brevo.com/api/v2/trackEvent \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'ma-key: ' \
--data '
{
"email": "[email protected]",
"event": "cart_updated",
"eventdata": {
"data": {
"added_product": [
{
"currency": "EUR",
"name": "Wrist watch",
"type": "accessories",
"price": "50.00"
}
]
}
},
"properties": {
"additionalProp": "string"
}
}
For the endpoint, there is an additional header ma-key
to send a request. The additional header ma-key
authenticates the user to use the track event endpoint.
You can choose any value you want for the field event and pass any key-value in the field properties. Make sure not to use any reserved key (email or event) in the properties object. The attributes to track events are defined in the table below.
Attribute | Datatype | Description | Value |
---|---|---|---|
email | String | Email to identify the user | [email protected] |
event | String | Event to track | item_deleted |
properties | Object | This object will content all your custom fields. Add as many as needed. Keep in mind that those user properties will populate your database on the Marketing Automation platform to create rich scenarios | (itemname, shirt) |
eventdata | Object | This object will contain all additional data you want to pass. It has three file ids' of type string with a unique number and data which can be later parametrised in a smtp template. | (deletedItem, white shirt) |
Response
The sample response to track events is a 204 response code that shows no content but the event is tracked successfully. The response codes and their explanation is defined below.
Response code | Message | Description |
---|---|---|
204 | Event has been tracked successfully | No content is shown in the JSON response but the event has been tracked |
400 | Bad request | Bad request occurs due to out_of_rangeModel , invalid_parameter , missingParameter |
Updated about 2 months ago