forked from airbrake/airbrake
-
Notifications
You must be signed in to change notification settings - Fork 0
Javascript support
shime edited this page Oct 27, 2012
·
3 revisions
To automatically include the Javascript node on every page, use this helper method from your layouts:
<%= airbrake_javascript_notifier %>
It's important to insert this very high in the markup, above all other javascript. Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<%= airbrake_javascript_notifier %>
<!-- more javascript -->
</head>
<body>
...
</body>
</html>
This helper will automatically use the API key, host, and port specified in the configuration.
The Javascript notifier tends to send much more notifications than the base Rails project.
If you want to receive them into a separate Airbrake project, specify its
API key in the js_api_key
option.
Airbrake.configure do |config|
# ...
config.js_api_key = 'another-projects-api-key'
end
To test the Javascript notifier in development environment, overwrite (temporarily) the development_environments option:
Airbrake.configure do |config|
# ...
config.development_environments = []
end