In JavaScript, you can use a function to modify the event or return a completely new one. If you return null
, the event will be discarded.
Sentry.init({
dsn: "___PUBLIC_DSN___",
// Called for message and error events
beforeSend(event) {
// Modify or drop the event here
if (event.user) {
// Don't send user's email address
delete event.user.email;
}
return event;
},
});