Get started with sentry-browser CDN

BSD-3-Clause licensed

Open-source JS tool: Sentry-browser monitors, reports, and fixes real-time web app issues.

Tags:
  • crash-reporting
  • error-monitoring
  • sentry
  • raven
  • sentry-client

Stable version

Copied!

How to start using sentry-browser CDN


import * as Sentry from '@sentry/browser';

// Initialize Sentry with your DSN (Data Source Name)
Sentry.init('your-dsn-here');

// Capture exceptions
window.onerror = function (event) {
  Sentry.captureException(event);
};

// Capture breadcrumbs
const breadcrumb = new Sentry.Breadcrumb('User clicked button');
breadcrumb.category = 'button';
breadcrumb.action = 'clicked';
breadcrumb.label = 'Submit';

// Add the breadcrumb to the current hub instance
Sentry.addBreadcrumb(breadcrumb);

// Capture performance issues
const performance = new Sentry.Performance('button-click');
performance.start();
document.querySelector('button').addEventListener('click', () => {
  performance.stop();
  Sentry.addPerformanceEvent(performance);
});

All versions

6.17.4 6.17.5 6.17.6 6.17.7 6.17.8 6.17.8-beta.0 6.17.9 6.18.0 6.18.1 6.18.1-beta.0 6.18.2 6.19.0 6.19.1 6.19.2 6.19.3 6.19.4 6.19.5 6.19.6 6.19.7 7.0.0 7.0.0-alpha.0 7.0.0-alpha.1 7.0.0-beta.0 7.0.0-beta.1 7.0.0-beta.2 7.0.0-rc.0 7.1.0 7.1.1 7.10.0 7.100.0 7.100.1 7.101.0 7.101.1 7.102.0 7.102.1 7.103.0 7.104.0 7.105.0 7.106.0 7.106.1 7.107.0 7.108.0 7.109.0 7.11.0 7.11.1 7.110.0 7.110.1 7.111.0 7.112.0 7.112.1 7.112.2 7.113.0 7.114.0 7.115.0 7.116.0 7.117.0 7.118.0 7.119.0 7.12.0 7.12.1 7.13.0 7.14.0 7.14.1 7.14.2 7.15.0 7.16.0 7.17.0 7.17.1 7.17.2 7.17.3 7.17.4 7.18.0 7.19.0 7.2.0 7.20.0 7.20.1 7.21.0 7.21.1 7.22.0 7.23.0 7.24.0 7.24.1 7.24.2 7.25.0 7.26.0 7.27.0 7.28.0 7.28.1 7.29.0 7.3.0 7.3.1 7.30.0 7.31.0 7.31.1 7.32.0 7.32.1 7.33.0 7.34.0 7.34.0-beta.0 7.35.0 7.36.0 7.37.0 7.37.1 7.37.2 7.38.0 7.39.0 7.4.0 7.4.1 7.40.0 7.41.0 7.42.0 7.43.0 7.44.0 7.44.1 7.44.2 7.45.0 7.46.0 7.47.0 7.48.0 7.49.0 7.5.0 7.5.1 7.50.0 7.51.0 7.51.1 7.51.2 7.52.0 7.52.1 7.53.0 7.53.1 7.54.0 7.55.0 7.55.1 7.55.2 7.56.0 7.57.0 7.57.0-beta.0 7.58.0 7.58.1 7.59.0-beta.0 7.59.0-beta.1 7.59.1 7.59.2 7.59.3 7.6.0 7.60.0 7.60.1 7.61.0 7.61.1 7.62.0 7.63.0 7.64.0 7.64.0-alpha.0 7.65.0 7.65.0-alpha.0 7.66.0 7.66.0-alpha.0 7.67.0 7.67.0-beta.0 7.68.0 7.69.0 7.7.0 7.70.0 7.70.0-beta.0 7.70.0-beta.1 7.71.0 7.72.0 7.73.0 7.74.0 7.74.1 7.74.2-alpha.0 7.74.2-alpha.1 7.75.0 7.75.1 7.76.0 7.77.0 7.78.0 7.79.0 7.8.0 7.8.1 7.80.0 7.80.1 7.80.2-alpha.0 7.80.2-alpha.1 7.81.0 7.81.1 7.82.0 7.83.0 7.84.0 7.85.0 7.86.0 7.87.0 7.88.0 7.89.0 7.9.0 7.90.0 7.91.0 7.92.0 7.93.0 7.94.1 7.95.0 7.96.0 7.97.0 7.98.0 7.99.0 8.0.0 8.0.0-alpha.1 8.0.0-alpha.2 8.0.0-alpha.3 8.0.0-alpha.4 8.0.0-alpha.5 8.0.0-alpha.7 8.0.0-alpha.8 8.0.0-alpha.9 8.0.0-beta.1 8.0.0-beta.2 8.0.0-beta.3 8.0.0-beta.4 8.0.0-beta.5 8.0.0-beta.6 8.0.0-rc.0 8.0.0-rc.1 8.0.0-rc.2 8.0.0-rc.3 8.1.0 8.10.0 8.11.0 8.12.0 8.12.0-beta.0 8.13.0 8.14.0 8.15.0 8.16.0 8.17.0 8.18.0 8.19.0 8.2.0 8.2.1 8.20.0 8.21.0 8.22.0 8.23.0 8.24.0 8.25.0 8.26.0 8.27.0 8.28.0 8.29.0 8.3.0 *** 8.30.0 8.4.0 8.5.0 8.6.0 8.7.0 8.8.0 8.9.0 8.9.1 8.9.2