Our next-gen architecture is built to help you make sense of your ever-growing data. Watch a 4-min demo video!

Back to All Docs

Enhance & Manage Browser RUM Data with beforeSend

Last Updated: May. 28, 2024

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

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

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.

Support

Need help?

Our world-class customer success team is available 24/7 to assist you with your setup and answer any questions you may have.

Feel free to reach out to us via our in-app chat or by emailing support@coralogix.com.

On this page