Issue
I want Sentry to receive errors from my own application code and filter out noise from third-party sources such as browser extensions, injected scripts, or third-party widgets.
Applies To
All SaaS Customers and Self-Hosted Users
JavaScript SDK (browser)
Error Monitoring
Filtering
thirdPartyErrorFilterIntegration
Resolution
Use thirdPartyErrorFilterIntegration in browser-based JavaScript SDKs from version 8.10.0 and above. It marks your bundled files with an application key at build time, then filters errors whose stack frames are unmarked (typical for extensions and other third-party scripts).
This does not drop npm packages that are bundled into your app. Those frames are marked as your code. For URL-based filtering, use allowUrls / denyUrls or other SDK filtering options.
Use a bundler with a Sentry bundler plugin, and set the same
applicationKeyyou will use at runtime. For Next.js with Turbopack, set_experimental.turbopackApplicationKeyinstead.Add
thirdPartyErrorFilterIntegrationtoSentry.initwith matchingfilterKeys.Choose a
behaviour(drop or tag errors that include third-party frames).
// Bundler plugin (example: Vite)
sentryVitePlugin({
applicationKey: "your-custom-application-key",
});// Sentry.init
Sentry.init({
integrations: [
Sentry.thirdPartyErrorFilterIntegration({
filterKeys: ["your-custom-application-key"],
behaviour: "drop-error-if-contains-third-party-frames",
}),
],
});
thirdPartyErrorFilterIntegration does not work with the Sentry Loader Script or CDN bundles. Those bundles are treated as third-party, so almost all events would match the filter behaviour.
See Using thirdPartyErrorFilterIntegration. If the integration is set up and still not filtering as expected, see Why is thirdPartyErrorFilterIntegration not filtering errors from outside my application?.
