These libraries provide observability tools for web applications, focusing on error tracking, performance monitoring, and user session replay. @sentry/browser and @bugsnag/js are comprehensive error tracking platforms with deep integration capabilities. logrocket specializes in session replay combined with console logs and network data. raygun, rollbar, and trackjs offer real-time error alerting with varying degrees of session context and telemetry data to help developers reproduce and fix issues faster.
When building production web applications, knowing when things break is only half the battle. You also need to understand why they broke and what the user experienced. The tools @bugsnag/js, @sentry/browser, logrocket, raygun, rollbar, and trackjs all aim to solve this, but they prioritize different aspects of observability. Let's compare how they handle initialization, error capture, session replay, and performance monitoring.
Every library requires a setup step to connect your app to their dashboard. The way they handle uncaught errors varies slightly in configuration.
@bugsnag/js uses a straightforward start method with an API key.
// @bugsnag/js
import Bugsnag from '@bugsnag/js';
Bugsnag.start({
apiKey: 'YOUR_API_KEY',
releaseStage: 'production'
});
// Manual notify
Bugsnag.notify(new Error('Something went wrong'));
@sentry/browser relies on a centralized init function with integrations.
// @sentry/browser
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: 'YOUR_DSN',
environment: 'production'
});
// Manual capture
Sentry.captureException(new Error('Something went wrong'));
logrocket initializes with an app ID and records sessions by default.
// logrocket
import LogRocket from 'logrocket';
LogRocket.init('YOUR_APP_ID');
// Manual track
LogRocket.track('Custom Event', { data: 'value' });
raygun (using browser library raygun4js) requires an API key and attaches handlers.
// raygun (raygun4js)
import raygun from 'raygun4js';
raygun.init('YOUR_API_KEY', { attachEvent: true });
// Manual send
raygun.send(new Error('Something went wrong'));
rollbar uses a configure method to set access tokens.
// rollbar
import Rollbar from 'rollbar';
const rollbar = new Rollbar({
accessToken: 'YOUR_TOKEN',
environment: 'production'
});
// Manual error
rollbar.error('Something went wrong');
trackjs installs agents to monitor telemetry before errors.
// trackjs
import { TrackJS } from 'trackjs';
TrackJS.install({
token: 'YOUR_TOKEN',
application: 'my-app'
});
// Manual track
TrackJS.track('Custom Event', { data: 'value' });
Seeing the user's journey is crucial for debugging UI issues. Some tools record video-like replays, while others focus on data trails.
@bugsnag/js offers session replay via a plugin or built-in config in newer versions.
// @bugsnag/js
import Bugsnag from '@bugsnag/js';
import bugsnagPluginReplay from '@bugsnag/plugin-session-replay';
Bugsnag.start({
apiKey: 'YOUR_KEY',
plugins: [bugsnagPluginReplay]
});
@sentry/browser includes a Replay integration that buffers events.
// @sentry/browser
import * as Sentry from '@sentry/browser';
import { Replay } from '@sentry/replay';
Sentry.init({
dsn: 'YOUR_DSN',
integrations: [new Replay({ maskAllText: true })]
});
logrocket is built around session replay as its core feature.
// logrocket
import LogRocket from 'logrocket';
LogRocket.init('APP_ID', {
network: { isEnabled: true },
console: { isEnabled: true }
});
raygun provides replay features to accompany crash reports.
// raygun (raygun4js)
import raygun from 'raygun4js';
raygun.init('YOUR_KEY', {
enableReplay: true,
replaySampleRate: 1.0
});
rollbar supports replay to contextualize errors.
// rollbar
import Rollbar from 'rollbar';
const rollbar = new Rollbar({
accessToken: 'YOUR_TOKEN',
captureUncaught: true,
replay: { enabled: true }
});
trackjs focuses on telemetry trails rather than full video replay.
// trackjs
import { TrackJS } from 'trackjs';
TrackJS.install({
token: 'YOUR_TOKEN',
telemetry: { enabled: true }
});
Slow apps drive users away. These tools help identify bottlenecks in loading and runtime.
@bugsnag/js tracks performance via sessions and timing.
// @bugsnag/js
import Bugsnag from '@bugsnag/js';
Bugsnag.start({ apiKey: 'YOUR_KEY' });
Bugsnag.leaveBreadcrumb('Performance check', { type: 'performance' });
@sentry/browser has robust performance tracing built-in.
// @sentry/browser
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: 'YOUR_DSN',
tracesSampleRate: 1.0
});
const transaction = Sentry.startTransaction({ name: 'load' });
logrocket captures network timing and slow loads automatically.
// logrocket
import LogRocket from 'logrocket';
LogRocket.init('APP_ID', {
network: { captureRequests: true }
});
raygun monitors real user performance metrics.
// raygun (raygun4js)
import raygun from 'raygun4js';
raygun.init('YOUR_KEY', {
enablePerformance: true
});
rollbar tracks performance alongside errors.
// rollbar
import Rollbar from 'rollbar';
const rollbar = new Rollbar({
accessToken: 'YOUR_TOKEN',
capturePerformance: true
});
trackjs records timing data leading to errors.
// trackjs
import { TrackJS } from 'trackjs';
TrackJS.install({
token: 'YOUR_TOKEN',
performance: { enabled: true }
});
Linking errors to specific users helps prioritize fixes, but privacy is critical.
@bugsnag/js sets user details explicitly.
// @bugsnag/js
Bugsnag.setUser('id', 'name', 'email');
@sentry/browser uses setContext or setUser methods.
// @sentry/browser
Sentry.setUser({ id: '123', email: 'user@example.com' });
logrocket identifies sessions for replay search.
// logrocket
LogRocket.identify('userID', { name: 'Name', email: 'email' });
raygun attaches user info to crash reports.
// raygun (raygun4js)
raygun.user = {
identifier: 'id',
email: 'user@example.com'
};
rollbar configures person data globally.
// rollbar
rollbar.configure({
payload: {
person: { id: '123', username: 'name' }
}
});
trackjs tracks user identity for telemetry correlation.
// trackjs
TrackJS.setUserId('userID');
Despite different focuses, these tools share core capabilities.
window.onerror and unhandled promise rejections.// All libraries automatically catch this without extra code
throw new Error('Global crash');
// CLI upload example (conceptual for all)
// npm run upload-sourcemaps -- --api-key=KEY
// Sentry example
Sentry.init({ beforeSend(event) { return sanitize(event); } });
// Others have similar hooks/callbacks
// Sentry React example
import { ErrorBoundary } from '@sentry/react';
// Bugsnag, Rollbar etc. have similar HOCs or hooks
| Feature | Shared by All |
|---|---|
| Error Capture | β Uncaught exceptions & promises |
| Source Maps | β De-minify stack traces |
| Privacy | β PII scrubbing options |
| Frameworks | β React, Vue, Angular support |
| Alerting | β Email/Slack notifications |
| Feature | @sentry/browser | logrocket | @bugsnag/js | raygun | rollbar | trackjs |
|---|---|---|---|---|---|---|
| Primary Focus | All-in-one | Session Replay | Error Stability | Alerting | Real-time Groups | Telemetry |
| Replay Type | Buffer-based | Full Video | Plugin-based | Add-on | Add-on | Data Trail |
| Performance | Deep Tracing | Network Timing | Session Timing | RUM | Basic | Pre-crash |
| Setup Complexity | Medium | Low | Low | Medium | Low | Low |
| Self-Host Option | β Yes | β No | β No | β No | β No | β No |
@sentry/browser is the Swiss Army knife πͺ β best for teams wanting errors, performance, and replays in one place with self-hosting options.
logrocket is the video recorder πΉ β best when reproducing UI bugs is the biggest bottleneck for your team.
@bugsnag/js is the stable anchor β β best for teams that want reliable error grouping without configuring too many features.
raygun is the alert system π¨ β best for teams prioritizing fast notifications and detailed crash reports.
rollbar is the deployment guard π‘οΈ β best for CI/CD pipelines needing immediate feedback on release health.
trackjs is the investigator π β best for understanding the behavior leading up to an error, not just the error itself.
Final Thought: While all these tools catch errors, the right choice depends on whether you need to see the video, trace the performance, or simply know the crash happened. Many teams combine a dedicated replay tool like LogRocket with a robust error tracker like Sentry or Bugsnag for full coverage.
Choose @bugsnag/js if you prioritize stability and precise error grouping without excessive noise. It is ideal for teams that need reliable crash reporting with minimal configuration overhead and strong support for release staging. The platform excels at distinguishing between handled and unhandled errors cleanly.
Choose @sentry/browser if you want an all-in-one solution covering errors, performance, and replays in a single dashboard. It fits well in complex architectures where distributed tracing and deep framework integrations are required. The open-source core allows for self-hosting if data residency is a concern.
Choose logrocket if seeing exactly what the user saw is your highest priority for debugging. It is best for support teams and developers who need to reproduce UI bugs that are hard to describe in text. The video-like replay combined with state inspection reduces time-to-resolution for visual issues.
Choose raygun if you need strong alerting capabilities and don't mind using raygun4js for browser implementation despite the npm package name. It suits teams that want detailed crash reports with custom data tagging and robust notification workflows. The platform is known for fast delivery of error notifications.
Choose rollbar if real-time error grouping and immediate deployment feedback are critical to your workflow. It works well for continuous deployment pipelines where knowing if a release broke something instantly is vital. The interface focuses heavily on sorting errors by impact and frequency.
Choose trackjs if you care more about the telemetry leading up to a crash than the stack trace alone. It is designed for catching 'near misses' and understanding user behavior before an error occurs. This approach helps fix issues that don't always throw exceptions but degrade experience.
Universal JavaScript notifier.
This package contains both @bugsnag/browser and @bugsnag/node and the appropriate one will be included in your application.
In Node, importing '@bugsnag/js' will provide the @bugsnag/node module.
In various bundlers, importing '@bugsnag/js' will provide the @bugsnag/browser module.
| Bundler | Support |
|---|---|
| Browserify | Supports the package.json "browser" field by default |
| Webpack | Supports the package.json "browser" field by default |
| Rollup | Set browser: true in the node-resolve plugin |
Note: by using this browser-specific entrypoint, none of the node-specific code will be included in your bundle.
This package is free software released under the MIT License. See LICENSE.txt for details.