We're working on something new! Hook Relay gives you Stripe-quality webhooks in minutes. Sign up for free today! Check out Hook Relay

How to Track Errors in Your Chrome Extension

Building a Chrome extension? Here’s a way to track and report errors using Honeybadger. In this post, Sam Smith of Sigstr shares how he set up Honeybadger to track errors, using CommonJS examples in our document library.

Looking to integrate Honeybadger in your Chrome Extension? Take a look at our Chrome Extension Integration Guide!

Releasing a new feature or product is always a harrowing adventure.

I’ve used Honeybadger for various projects over the last few years, and naturally, my team set it up when I came to build Sigstr. We love the ability to see what our customers are experiencing. It lets us be hyper-reactive to problems, helps our product team prioritize tasks, and provides deeper insights to our customer service team.

When my team started building Sigstr’s Chrome Extension to support our new Dynamic Campaign feature, we quickly realized the need to gain awareness into application behaviors encountered by users who installed the extension.

So I wondered how we could use Honeybadger to report errors for our Chrome extension. Here’s what we did.

Create a New Project in Honeybadger

We created a new project in our Honeybadger account so we could track the errors separately from our other projects. A new project gives us a new Honeybadger API key to use in the steps below.

Set up Honeybadger in the Code

Using the “CommonJS” examples from the Honeybadger install docs, we went about setting up the requirements needed to report notifications back to Honeybadger.

First, we added the latest honeybadger.min.js source to the root of our extension’s project. At time of build, that was https://js.honeybadger.io/v0.4/honeybadger.min.js.

Next, we made sure that Honeybadger is listed as an accessible resource in our manifest.json file. We also made sure that manifest.json listed the content.js file, which we used to include the Honeybadger source.

"content_scripts": [
        "js": ["content.js"]
"web_accessible_resources": [

Then, inside of content.js, we loaded the Honeybadger source into the DOM.

var s = document.createElement('script');
s.src = chrome.extension.getURL('honeybadger.min.js');
(document.head || document.documentElement).appendChild(s);

Sending Notifications to Honeybadger

Now, we’re able to use the Honeybadger library within our extension and start reporting notifications and errors back to the new project we created.

Within our main.js file for the extension, we set up a new Honeybadger configuration. We also added in context data so we can get a better handle on which users are associated with each notification.

    api_key: your_api_key_here
Honeybadger.setContext({ user_email: user_email_here });

Sending a Notification

With Honeybadger all set up, we created a simple test call in main.js to send a notification to our new project.

try {
} catch(error) {

Chrome extension project

After packaging the above code into a new test version, we installed the test extension in Chrome. Executing the new tracking code results in a notification being reported to Honeybadger!

Honeybadger has your back when it counts. We're the only error tracker that combines exception monitoring, uptime monitoring, and cron monitoring into a single, simple to use platform.

Our mission: to tame production and make you a better, more productive developer. Learn more

author photo

Sam Smith

Sam Smith is VP of Product for Sigstr.com. He has a passion for problem solving and leveraging technology to improve lives. Outside of Sigstr he can be found biking throughout and enjoying the vibrant culture of Indianapolis.

“We’ve looked at a lot of error management systems. Honeybadger is head and shoulders above the rest and somehow gets better with every new release.”
Michael Smith
Try Error Monitoring Free for 15 Days