Configuration options

The object passed to bugsnag({ … }) can be used to configure and customize the behaviour of the library. Additionally, some properties of the client object returned by the bugsnag(…) function can be set.


Set your Bugsnag API key. You can find your API key in your project settings from your Bugsnag dashboard:

bugsnag({ apiKey: 'API_KEY' })


Setting the appVersion lets you see at a glance when errors first and last happened in your code:

bugsnag({ appVersion: '4.10.0' })


By default, Bugsnag will collect console, interaction, navigation and network breadcrumbs. To switch all of these off, set the autoBreadcrumbs option to false:

bugsnag({ autoBreadcrumbs: false })

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


By default, Bugsnag will automatically capture and report session information from your application.

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()

If you switch off automatic session tracking with the autoCaptureSessions option, you can still send sessions manually by calling bugsnagClient.startSession() when appropriate for your application.


By default, we will automatically notify Bugsnag of any uncaught exceptions and unhandled promise rejections. If you want to stop this from happening, you can set autoNotify to false:

bugsnag({ autoNotify: false })


To modify error reports before they are sent, or to prevent them from being sent at all, beforeSend provides access the report data structure and the means to mutate or ignore it:

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

For more information, see Customizing error reports.


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

If you are using Bugsnag On-premise you’ll need to set these to your Event Server and Session Server endpoints. If the notify endpoint is set but the sessions endpoint is not, session tracking will be disabled automatically to avoid leaking session information outside of your server configuration, and a warning will be logged.

To set the endpoints:

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


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 })


By default, the notifier’s log messages are prefixed with [bugsnag] and output to the console (if the browser has a useful console object). You can supply your own logger instead, or switch off logging completely by setting logger: null.

If you supply a logger, it must have the following methods: debug, info, warn and error.

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

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


By default, up to 20 breadcrumbs will be sent along with each error report. You can optionally configure this up to a hard limit of 40.

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 window.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 })


By default, we will notify Bugsnag of exceptions that happen in any releaseStage. If you would like to change which release stages notify Bugsnag of errors you can set notifyReleaseStages.

bugsnag({ notifyReleaseStages: [ 'production', 'staging' ] })


If you would like to distinguish between errors that happen in different stages of the application release process (development, production, etc) you can set the releaseStage that is reported to Bugsnag.

By default, if the URL contains localhost this is set to development, otherwise it takes the value from process.env.NODE_ENV. The default value in all other circumstances is production.

bugsnag({ releaseStage: 'staging' })

Client properties

You should set to your application’s version number/identifier (if it has one). This is useful for finding out when errors are introduced or fixed. Additionally Bugsnag can re-open closed errors if a later version of the app has a regression. = '1.2.3'

Set the release stage that is reported to Bugsnag. Note that you can also set releaseStage via this interface. = 'staging'


By default, Bugsnag sets the context for each report to window.location.pathname. Context is given high visual prominence in the dashboard, so if the pathname is not useful to you in tracking down errors, you can set it to something else.

bugsnagClient.context = 'ctx-id-1234'


By default, the notifier will set some device properties: time, locale and userAgent. If you want to collect additional information or override one of these values you can do so here.

bugsnagClient.device = { orientation: 'portrait', hasTouch: true }


Set any metaData that you want to send with all reports by attaching it to the client object.

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


By default, the notifier will capture { url: window.location.href } when a report is sent. You can capture any other useful information about the request that loaded the page here.

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


The user property is used to populate the “User” tab of reported errors on your Bugsnag dashboard, and the id property is used to determine the number of users affected by a particular error. You can attach any additional user information here.

bugsnagClient.user = {
  id: '3',
  name: 'Bugs Nag',
  email: '',
  roles: [ 'subscriber' ]