---
title: "Custom events"
slug: "custom-events"
abstract: "Describes the event object for a custom event in the Boxever JavaScript Library (Sitecore CDP Stream API)."
---
# Custom events

The event object for a custom event must include all the [required attributes for event objects](https://doc.sitecore.com/cdp/en/developers/api/stream-api/bx-js-library-legacy-reference/objects-1166464/event-object.html#UUID-9f8f6e1a-da8b-6bc6-f778-4468525242e9_UUID-97825386-9ff8-1c1e-31fc-a50ce09e734c "Required attributes"). Set the value of the `type` attribute to a custom event name of your choice. The custom event name must be different than [Sitecore CDP reserved event names](https://doc.sitecore.com/cdp/en/developers/api/stream-api/bx-js-library-legacy-reference/objects-1166464/event-object.html#UUID-9f8f6e1a-da8b-6bc6-f778-4468525242e9_para-idm1903321099957780).

You can add custom attributes of your choice.

## Example

This example describes an event object for a custom event in an integration that uses the Boxever JavaScript Library. The `browser_id` is set to the value that the `[Boxever.getID()](../../functions-1166463/bx-getid.md "Boxever.getID()")` function returns.

In the `type` attribute of the event, the custom event name is specified as `myretailsite:CLICKED_POPUP`. The event contains the custom attributes `clickedPopup` and `timeBetweenPopupAndClick`.

```javascript
const customEvent = {
    browser_id: Boxever.getID(),
    channel: "WEB",
    type: "myretailsite:CLICKED_POPUP",
    language: "EN",
    currency: "EUR",
    page: "home",
    pos: myretailsite/ireland,
    clickedPopup: isPopupClicked(), // true or false
    timeBetweenPopupAndClick: `${getTimestampPopup() - getTimestampClick()} ${timeUnit}` // for example, "8 seconds"
};

```