For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Help CenterAPI KeysStatusSign In
GuidesAPI ReferenceChangelog
GuidesAPI ReferenceChangelog
  • Getting started
    • Overview
    • Quickstart
    • Authentication
    • Rate limits
  • Messaging API
    • Send transactional email
    • Send transactional SMS
    • Send transactional WhatsApp
  • Marketing Platform
    • Manage your contacts
    • Track website activity
    • Send WhatsApp campaigns
    • Weekly event exports
  • Webhooks
    • Getting started
    • Conversations webhooks
    • Payment webhooks
    • Marketing webhooks
    • Transactional webhooks
    • Loyalty webhooks
    • Batched webhooks
    • Secure webhook calls
    • Meetings and phone webhooks
    • Push notification webhooks
    • Sales CRM webhooks
  • Conversations
    • Getting started
    • Customize the chat widget
    • JavaScript API reference
    • REST API reference
    • Conversations webhooks
  • eCommerce
    • Activate eCommerce app
    • Manage product categories
    • Manage products
    • Manage orders
    • Coupon collections
    • eCommerce tracker events
  • Loyalty
    • Overview
    • Set up a program
    • Enroll members
    • Credit & debit points
    • Read member data
    • Best practices
  • Custom Objects
    • Custom objects management
  • Brevo tracker and events
    • Getting started
    • JavaScript implementation
      • Identify users
      • Track page views
      • Track link clicks
      • Track custom events
    • REST implementation
    • Legacy tracker documentation
    • Events
  • Accounts and settings
    • Senders and domains
    • User activity logs
    • External feeds
    • Invited users
LogoLogo
Help CenterAPI KeysStatusSign In
Brevo tracker and eventsJavaScript implementation

Track custom events

Was this page helpful?
Previous

REST implementation

Next
Built with
Legacy Tracker Documentation

For the legacy tracker doc, check our guide here.

Custom events are events you choose to track. They are custom in the sense that you can give them any name you want.

Use them in various situations — for example, in an eCommerce shop, to track cart events. The syntax is:

1Brevo.push([
2 "track",
3 event_name, /* mandatory */
4 properties, /* optional */
5 event_data /* optional */
6]);

Parameters:

AttributeDatatypeDescriptionValue
event_nameStringName of your event"cart_updated"
propertiesJSON objectDescribes the state of the visitor{"email": "john.doe@email.com","FIRSTNAME": "John","LASTNAME": "doe"}
event_dataJSON objectJSON object used to pass information about the eventSee example below

Example event_data:

1event_data = {
2 "id": "cart:1234",
3 "data": {
4 "total": 280,
5 "currency": "USD",
6 "url": "www.example.com",
7 "items": [{
8 "name": "Black shoes",
9 "price": 90,
10 "quantity": 2,
11 "url": "www.example.com/black-shoes",
12 "image": "www.example.com/black-shoes.jpg"
13 }
14 ]
15 }
16}

Example

1var event_name = "cart_updated";
2var properties = {
3 "email": "john.doe@email.com",
4 "FIRSTNAME": "John",
5 "LASTNAME": "doe"
6}
7
8var event_data = {
9 "id": "cart:1234",
10 "data": {
11 "total": 280,
12 "currency": "USD",
13 "url": "www.example.com",
14 "items": [{
15 "name": "Black shoes",
16 "price": 90,
17 "quantity": 2,
18 "url": "www.example.com/black-shoes",
19 "image": "www.example.com/black-shoes.jpg"
20 }
21 ]
22 }
23}
24
25Brevo.push([
26 "track",
27 event_name, /* mandatory */
28 properties, /* optional */
29 event_data /* optional */
30]);