Skip to main content

Help

Error Tracking Setup

SquirrelStack error tracking is compatible with the Airbrake notifier protocol. You can use any Airbrake-compatible client library to send errors to SquirrelStack.

Basic configuration

Configure your Airbrake notifier to point at your SquirrelStack instance:

# config/initializers/airbrake.rb
Airbrake.configure do |c|
  c.host = "https://squirrelstack.app"
  c.project_id = 1
  c.project_key = "YOUR_API_KEY" # Your SquirrelStack API key
end

Your API key can be found in Settings > API Keys.

Linking errors to companies and contacts

To see which companies and users are affected by each error, send account_id and user details in the error context. SquirrelStack will match these against the Product account ID field on your subscriptions and the Product user ID field on your contacts.

Sending account and user context

Use an Airbrake filter to attach identifying information to every error notice:

Airbrake.add_filter do |notice|
  if (user = Current.user)
    notice[:context][:userId] = user.id.to_s
    notice[:context][:userName] = user.name
  end

  if (account = Current.account)
    notice[:context][:account_id] = account.id.to_s
  end
end

Setting up the mapping in SquirrelStack

  1. Subscriptions: Edit a subscription and set the Product account ID to the value your app sends as account_id. This links error occurrences to the subscription’s company.

  2. Contacts: Edit a contact and set the Product user ID to the value your app sends as userId. This links error occurrences to that contact.

Once configured, error pages will show:

  • Error detail page — an “Affected companies” card listing all companies that have encountered the error
  • Occurrence detail page — the matched company and contact in the Request section

JavaScript notifier

For browser-side errors, use the @airbrake/browser package:

import { Notifier } from "@airbrake/browser";

const airbrake = new Notifier({
  host: "https://squirrelstack.app",
  projectId: 1,
  projectKey: "YOUR_API_KEY",
});

airbrake.addFilter((notice) => {
  notice.context.account_id = window.currentAccountId;
  notice.context.userId = window.currentUserId;
  notice.context.userName = window.currentUserName;
  return notice;
});

Supported context fields

Field Maps to Description
context.account_id Subscription → Company Your product’s account/tenant identifier
context.userId Contact Your product’s user identifier
context.userName Display only Shown on occurrence details