diff --git a/src/router.tsx b/src/router.tsx index ecefda06..6d830ecb 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -53,6 +53,27 @@ if (typeof document !== 'undefined') { // Session Replay replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production. replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur. + beforeSend(event) { + // Filter out errors from third-party ad tech scripts (e.g. Publift's + // Fuse Platform ftUtils.js) that are not actionable by us. + const frames = event.exception?.values?.flatMap( + (v) => v.stacktrace?.frames ?? [], + ) + if ( + frames && + frames.length > 0 && + frames.every((frame) => { + const filename = frame.filename ?? '' + return ( + filename.includes('ftUtils.js') || + filename.includes('fuseplatform.net') + ) + }) + ) { + return null + } + return event + }, }) deferSentryReplayIntegration()