---
title: Hoptoad and Javascript, Sitting in a Tree, S-E-N-D-I-N-G
teaser: You can send errors from JS to Hoptoad now, wow.
tags: news,web,javascript,airbrake
author: Josh Clayton
published_on: 2010-08-03
---

With an [open API](http://hoptoadapp.com/pages/api), [Hoptoad, the app error
app](http://hoptoadapp.com), can track errors from any sort of app you want:
Rails, Sinatra, Rack, <abbr title="PHP HyperText Preprocessor">PHP</abbr>, C#...
the list goes on.  We didn't want to leave front-end developers in the dark when
their Javascript throws errors, so we've added a Hoptoad notifier for
Javascript!

I'm sure you're asking, "How do I participate in this awesomeness?".  It's easy.

If you're using the [hoptoad_notifier
gem](http://rubygems.org/gems/hoptoad_notifier), upgrade to the latest version
(2.3.7 at the time of this update) and update your
`config/initializers/hoptoad.rb`:

    HoptoadNotifier.configure do |config|
      config.api_key = 'YOUR-PROJECT-API-KEY'
      config.js_notifier = true # ADD ONE LINE FOR JAVASCRIPT ERROR TRACKING!
    end

Yes, that's it.

The gem injects Javascript right after your `<head>` tag.  Done!

### Not using hoptoad_notifier gem

If you're _not_ using the hoptoad_notifier gem, you'll just need to include a
couple of lines (at the top of your `<head>`):

    <script type="text/javascript" src="http://hoptoadapp.com/javascripts/notifier.js"></script>
    <script type="text/javascript">
      Hoptoad.setKey('YOUR-PROJECT-API-KEY');
    </script>

### The details

You may be proclaiming, "Oh no, Javascript at the top of `<head>`!  What are you
thinking?"  I'll let you in on a little secret: we want our Javascript loaded
before any other Javascript.  That way, if one of those libraries throws an
exception, we're there to let you know!

The nitty-gritty details: we're currently only supporting [browsers that support
the `onerror` event (Firefox 2+,
IE6+)](http://www.quirksmode.org/dom/events/error.html).  You'll also be
including your project <abbr title="Application Programming
Interface">API</abbr> key on the page.  **This is different from your user <abbr
title="Application Programming Interface">API</abbr> key, so there's no need to
worry about someone deleting your projects or users.**  We'll continue to expand
this feature and let you know as we progress.  If you have any suggestions or
spot a bug, [let us know](http://help.hoptoadapp.com)!

So, what're you waiting for?  It takes 30 seconds to sign up; [go grab an
account and start tracking your Javascript errors
now](https://hoptoadapp.com/account/new)!

FYI: _Hoptoad/Airbrake was sold to RackSpace and is now called [Airbrake Bug Tracker](http://airbrake.io)_.
