Configuration

There are two ways to configure Honeybadger: using Honeybadger.configure, and using data attributes (when loading via a script tag).

All of the available configuration options are shown below:

Honeybadger.configure({
  // Output Honeybadger debug messages to the console
  debug: false,

  // Honeybadger API key (required)
  apiKey: '',

  // The revision of the current deploy
  revision: '',

  // Collector Host
  host: 'api.honeybadger.io',

  // Use SSL?
  ssl: true,

  // Project root
  projectRoot: 'http://my-app.com',

  // Environment
  environment: 'production',

  // Component (optional)
  component: '',

  // Action (optional)
  action: '',

  // Ignore Patterns (optional)
  // Array of error messages as regexes that should be ignored
  ignorePatterns: [/known\ error/i],

  // Should unhandled (window.onerror) notifications be sent?
  onerror: true,

  // Disable notifications?
  disabled: false,

  // Send notifications asynchronously
  async: true,

  // Limit the maximum number of errors the client will send to Honeybadger
  // after page load. Default is unlimited (undefined)
  maxErrors: 20
});

Configuring via data attributes

The global Honeybadger instance may also be configured via data attributes on the script tag which loads honeybadger.js:

<script src="honeybadger.js" type="text/javascript" data-apiKey="project api key" data-environment="production" data-revision="git SHA/project version"></script>