Skip to main content
The Sentry Browser SDK provides comprehensive error monitoring and performance tracking for JavaScript applications running in the browser.

Installation

Basic Setup

Initialize Sentry as early as possible in your application, before any other code runs:

Core Features

Error Tracking

Capture exceptions automatically or manually:

Context & Breadcrumbs

Add context to understand errors better:

Performance Monitoring

Browser Tracing

Track page load performance and navigation:

Custom Performance Spans

Track specific operations:

Advanced Integrations

Replay user sessions to understand what happened before an error:

Additional Integrations

HTTP Client Monitoring

Monitor fetch and XHR requests:

Context Lines

Capture source code context around errors:

Reporting Observer

Capture browser interventions and deprecations:

CDN Installation

For quick setup without a bundler:

Configuration Options

Transport & Offline Support

Handle offline scenarios:

Best Practices

Initialize Early

Call Sentry.init() before any other JavaScript code runs to catch all errors.

Source Maps

Upload source maps to get readable stack traces in production.

Sampling

Use appropriate sample rates in production to control costs.

Context

Add user context and breadcrumbs to make errors easier to debug.

Next Steps

Source Maps

Learn how to upload source maps

Performance

Deep dive into performance monitoring

Session Replay

Set up session replay

User Feedback

Collect user feedback