# Enhance \&amp; manage browser RUM data with beforeSend

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fuser-guides%2Frum%2Fsdk-features%2Fenhance-and-manage-browser-rum-data-with-beforesend.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fuser-guides%2Frum%2Fsdk-features%2Fenhance-and-manage-browser-rum-data-with-beforesend.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

Enable event access and modification before sending data to Coralogix using `beforeSend`. This feature allows you to modify content or discard events as needed.

## Overview[​](#overview "Direct link to Overview")

The `beforeSend` callback method can be configured to filter error events just before they are sent to the server. This method provides a final opportunity to decide whether to send or modify the data. The `beforeSend` function receives the event object as a parameter, allowing you to use custom logic to either alter the event’s data or discard it entirely by returning null.

## Usage[​](#usage "Direct link to Usage")

Here is an example demonstrating how to use `beforeSend`:

```
CoralogixRum.init({

  // ...

  beforeSend: (event) => {

    // Discard events from @company.com users.

    if (event.session_context.user_email?.endsWith('@company.com')) {

      return null;

    }



    // Redact sensitive information from the page URL.

    event.page_context.page_url = event.page_context.page_url.replace(

      'sensitive-info',

      'redacted'

    );



    return event;

  },

});
```

**Notes**:

* To retain the event, you must `return event`.

* To discard the event, return `null`.
