> For the complete documentation index, see [llms.txt](https://docs.salesmonk.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.salesmonk.ai/setup/javascript-events.md).

# JavaScript Events

RevenueHero JavaScript events are sent from the scheduler at different stages. Learn about those events that can be used to trigger downstream activities.

The **SaaSMonk Chat Widget** tracks and emits the following JavaScript events through the lifecycle of the chat experience. These can be captured using a sample message listener like the following to be used for actions like sending event to Google Analytics, Pixel, etc.

```javascript
window.addEventListener("message", (ev) => {
  if (ev.data.type == "MEETING_BOOKED") {
    // Send to Google Analytics
    dataLayer.push({ event: "meeting_booked" });

    // Send to pixel
    fbq("track", "RevenueHero", { event: "meeting_booked" });
  }
});
```

### MEETING\_BOOKED

The event is sent when a meeting is booked successfully through a calendar integrated within our widget

```json
{
  "type": "MEETING_BOOKED",
  "meeting": {
    "id": "1234",
    "attributes": {
      "booker_name": "John Smith",
      "booker_email": "john.smith@acme.com",
      "phone_number": "+11234567890",
      "booker_company_name": "Acme, Inc",
      "country_code": "US",
      "calendar_type": "calendly",
      "meeting_time": "2023-11-24T05:30:00.000Z",
      "created_at": "2023-11-24T05:30:00.000Z",
      "booking_guests": ["jackie@acme.com"],
      "booked_with_name": "Jane Doe",
      "booked_with_email": "jane@abc.com"
    }
  }
}
```
