Sending Events to Insights
Honeybadger's JavaScript library can be used to send events to Insights.
Automatic Log Instrumentation
You can send console logs to Insights either by sending your logs to Honeybadger from your infrastructure or by setting the eventsEnabled
flag to true
when configuring Honeybadger:
Honeybadger.configure({
// ...
eventsEnabled: true
});
This will send all log messages to Honeybadger, where they will be displayed in the Insights section of your dashboard.
Manually Sending Events
You can also send events to Honeybadger using the Honeybadger.event
method:
Honeybadger.event('button_click', {
action: 'buy_now',
user_id: 123,
product_id: 456
})
The first argument is the type of the event (event_type
) and the second argument is an object containing any additional data you want to include.
Honeybadger.event
can also be called with a single argument as an object containing the data for the event:
Honeybadger.event({
event_type: 'button_click',
action: 'buy_now',
user_id: 123,
product_id: 456
})
A timestamp field (ts
) will be automatically added to the event data if it is not provided, regardless of the method overload used to send the event.