Configuration options


Configuration options should be set in addition to the API key:

var bugsnagClient = bugsnag({
  apiKey: 'YOUR_API_KEY',
  otherOption: value



bugsnag({ apiKey: 'API_KEY' })



bugsnag({ appVersion: '4.10.0' })




bugsnag({ appType: 'client' })
bugsnag({ appType: 'web_worker' })
bugsnag({ appType: 'service_worker' })




bugsnag({ autoBreadcrumbs: false })

For more granularity, there are options to toggle each kind of automatic breadcrumb, see:



If the notify endpoint is changed and the sessions endpoint is not, this option will be set to false and session tracking will be disabled.

To disable automatic session capturing:

bugsnag({ autoCaptureSessions: false })

Bugsnag will automatically report a session each time:

  • The page loads
  • The URL changes via history.pushState() or history.replaceState()



bugsnag({ autoNotify: false })



  beforeSend: function (report) {
    // Adjust report here

Asynchronous beforeSend callbacks



  beforeSend: report =>
    new Promise((resolve, reject) => {
      // doing some asynchronous work, resolving when done
      // to stop the report from being sent resolve with false
      // or call report.ignore()
  beforeSend: (report, cb) =>

    // the report from being sent

    // prevent report from sending
    cb(null, false)
    // or



By default the IP address of the user whose browser reported an error will be collected and displayed in the request tab. If you want to prevent IPs from being stored, set this option to false.

bugsnag({ collectUserIp: false })

Note that if you prevent collecting the user IP, we strongly suggest that you provide a See the removing IP address section for more info.


Wrapping console methods to leave breadcrumbs has the side effect of messing with line numbers in log messages. Therefore when releaseStage='development' console breadcrumbs are disabled. If you want to disable them in other environments, or switch them on in development, use this option.

Setting this option explicitly will trump the autoBreadcrumbs setting.

// enable autoBreadcrumbs but disable console breadcrumbs
bugsnag({ consoleBreadcrumbsEnabled: false })

// disable all other breadcrumbs but enable console breadcrumbs
bugsnag({ autoBreadcrumbs: false, consoleBreadcrumbsEnabled: true })


By default we will send error reports to and sessions to


To set the endpoints:

  endpoints: {
    notify: '',
    sessions: ''


Filter out properties from the payloads that are sent to Bugsnag using strings (for exact matches) and regexs (for pattern matching).



The array can include both strings and regexes.

  filters: [
    'access_token', // exact match: "access_token"


By default, breadcrumbs are left when the user clicks/touches the page.

Setting this option explicitly will trump the autoBreadcrumbs setting.

// enable autoBreadcrumbs but disable interaction breadcrumbs
bugsnag({ interactionBreadcrumbsEnabled: false })

// disable all other breadcrumbs but enable interaction breadcrumbs
bugsnag({ autoBreadcrumbs: false, interactionBreadcrumbsEnabled: true })




// switch off logging
bugsnag({ logger: null })

// supply a custom logger
var myCustomLogger = {
  debug: function () {},
  info: function () {},
  warn: function () {},
  error: function () {}
bugsnag({ logger: myCustomLogger })



bugsnag({ maxBreadcrumbs: 40 })


Configure the maximum number of events that can be sent per page. The count is reset each time the location changes via pushState/replaceState. The default value is 10 and the maximum allowed value is 100.

bugsnag({ maxEvents: 100 })

By default, breadcrumbs are left on page loads, DOMContentLoaded events, pushState/replaceState calls, and popstate/hashchange events.

Setting this option explicitly will override the autoBreadcrumbs setting.

// enable autoBreadcrumbs but disable navigation breadcrumbs
bugsnag({ navigationBreadcrumbsEnabled: false })

// disable all other breadcrumbs but enable navigation breadcrumbs
bugsnag({ autoBreadcrumbs: false, navigationBreadcrumbsEnabled: true })


By default, breadcrumbs are left for network requests initiated via the XMLHttpRequest constructor and fetch() calls. Metadata includes HTTP method, request URL and status code (if available).

Setting this option explicitly will override the autoBreadcrumbs setting.

// enable autoBreadcrumbs but disable network breadcrumbs
bugsnag({ networkBreadcrumbsEnabled: false })

// disable all other breadcrumbs but enable network breadcrumbs
bugsnag({ autoBreadcrumbs: false, networkBreadcrumbsEnabled: true })






bugsnag({ releaseStage: 'staging' })

By default, if the URL contains localhost this is set to development. The default value in all other circumstances is production. If you want to use the NODE_ENV environment variable from your build, use one of the following plugins appropriate for your bundler:

And then set the option:

bugsnag({ releaseStage: process.env.NODE_ENV })


By default, Bugsnag wraps every source of asynchronous execution in order to reliably track errors from inline scripts and include the surrounding code. To disable this behaviour, set this option to false. Errors will still be reported from inline scripts, but they will not include any surrounding code.

bugsnag({ trackInlineScripts: false })

Client properties





bugsnagClient.context = 'ctx-id-1234'






bugsnagClient.metaData = {
  company: {
    name: "Acme Co.",
    country: "uk"



bugsnagClient.request = { body: 'item=1234,' }



bugsnagClient.user = {
  id: '3',
  name: 'Bugs Nag',
  email: ''


 bugsnagClient.metaData.user = {

Client methods

client.notify(err, opts, cb)



client.leaveBreadcrumb(message, metaData, type, timestamp)

Adds a breadcrumb.

  • message [required] a meaningful summary of the event
  • metaData [optional] a one-level-deep key → value mapping object of additional data associated with the event
  • type [optional] [default: manual] a string indicating the breadcrumb type. This is not a free text field, and is typically reserved for automatic breadcrumbs.
  • timestamp [optional] an ISO 8601 string representing when the event happened. Unless this value is provided, it is set to the time that leaveBreadcrumb() was called.



Single user processes


Multi-user processes


// this starts a session
var sessionClient = client.startSession()

// this error is reported with session information
sessionClient.notify(new Error('boom'))

// this error is not reported with session information
// because it uses the original client
client.notify(new Error('bam'))


client.use(plugin, ...args)


  • plugin [required] a plugin definition

Example: @bugsnag/plugin-vue

This plugin requires the Vue instance to be passed in:

var Vue = require('vue')
client.use(bugsnagVue, Vue)


Access the return value of a plugin.

  • string [required] the plugin’s name

Example: @bugsnag/plugin-react

The React plugin returns an ErrorBoundary component

var ErrorBoundary = client.getPlugin('react')