---
title: Filtering events
description: Ignore or modify events before they're sent from your PHP application to Honeybadger Insights.
url: https://docs.honeybadger.io/lib/php/insights/filtering-events/
---

You can ignore events programmatically using the `beforeEvent` callback. This callback is called before an event is sent to Honeybadger. If the callback returns `false`, the event will not be sent.

For example, you can ignore events based on the event type:

```php
$honeybadger->beforeEvent(function (&$event) {
    if ($event['event_type'] === 'user_activity' && $event['action'] === 'registration') {
        return false;
    }
});
```

Or, you may modify the event data before it is sent:

```php
$honeybadger->beforeEvent(function (&$event) {
    $event['user_id'] = 456;
});
```

**Note**: You can register multiple `beforeEvent` callbacks. If any of them return `false`, the event will not be sent.

## Sampling events

If you’d rather reduce event volume across the board instead of ignoring specific events, see [Sampling events](https://docs.honeybadger.io/lib/php/insights/sampling-events/).

---

## Try Honeybadger for FREE

Intelligent logging, error tracking, and Just Enough APM™ in one dev-friendly platform. Find and fix problems before users notice.

[Start free trial](https://app.honeybadger.io/users/sign_up)

[See plans and pricing](https://www.honeybadger.io/plans/)
