Auto-instrumentation

What the SDK captures in the browser without any code, and at which level.

Overview

In a browser, the SDK captures events without any code from you. Choose which with autoCapture; anything you leave out keeps its default.

TypeScript
import { Apperio } from 'apperio';

const logger = new Apperio({
  apiKey: 'your-api-key',
  projectId: 'your-project-id',
  autoCapture: {
    errors: true,           // default true
    performance: true,      // default true
    networkRequests: true,  // default true
    pageViews: true,        // default true
    consoleMessages: false, // default false
    userInteractions: false // default false
  },
});

None of this runs in Node.js. On a server, log what you need yourself; see the Node.js guide.

Levels decide what is sent

Every captured event becomes a log with a level, and the SDK drops logs below minLogLevel (default info). Many routine events are logged at debug or trace, so they are captured but never sent unless you lower minLogLevel. The tables below list each event’s level.

errors

EventLevelMessage
Uncaught error (window error event)errorThe error’s name and message, such as TypeError: x is undefined
Unhandled promise rejectionerrorThe rejection’s name and message

Each report includes the stack trace, the file, line and column the browser gave, the recent breadcrumb trail, and a snapshot of the page: its address, viewport size, scroll position, whether the browser was online and, where the browser exposes them, the connection type and memory use. See Error tracking.

performance

EventLevel
Page loadwarn over 3 s, info over 1 s, otherwise debug
Script or stylesheetwarn over 3 s, info over 1 s, otherwise debug
Other resourcewarn over 3 s, otherwise debug
Paint timing and your own performance measuresdebug
LCPwarn over 4 s, info over 2.5 s, otherwise debug
CLSwarn over 0.25, info over 0.1, otherwise debug
INP, per interaction of 40 ms or morewarn over 500 ms, info over 200 ms, otherwise debug

Web Vitals carry a good, needs-improvement or poor rating. See Performance and Web Vitals.

networkRequests

EventLevelMessage
Response with status 500 or aboveerrorServer Error
Response with status 400 to 499warnClient Error
Response below 400 that took over 5 swarnSlow Network Request
Request that fails outright (fetch only)errorNetwork Request Failed
Any other responsedebugNetwork Request

Covers fetch and XMLHttpRequest, so libraries built on them, such as axios, are covered too. Each entry has the method, URL, status and duration. The token, key, password, secret and api_key query parameters are replaced with [REDACTED]. Requests to Apperio itself are skipped.

pageViews

Logs a Page View at info when the page loads and after every history.pushState, history.replaceState and back or forward navigation, with the address, title and referrer. Single-page app route changes are therefore counted, and so are calls to replaceState that don’t change the page.

consoleMessages

CallLevelMessage
console.errorerrorConsole Error
console.warnwarnConsole Warning
console.loginfoConsole Log
console.infoinfoConsole Info
console.debugdebugConsole Debug

The arguments are converted to strings and stored in the log’s data. The console still prints as usual.

Noisy, and it counts itself

Every console.error becomes an error and can open an issue, including ones from third-party scripts.

The SDK’s own console messages are captured too, such as Apperio: Network error on attempt 1 when Apperio can’t be reached. Turn this on while investigating, not permanently.

userInteractions

EventLevel
Click, with the element’s selector and coordinatesdebug
Focus and blurdebug
Scroll, at most one per 100 mstrace
Key press, at most one per 100 ms, without the keytrace

All of these are below info, so with the default level none are sent. Clicks still feed the breadcrumb trail. To see clicks and scrolling in context, use session replay instead.

The SDK keeps the last 50 page views, network requests, console messages and clicks it has captured (each kind only when its capture is on), and attaches them to every error it captures by itself. The trail lives in memory and is only sent as part of an error. logger.addBreadcrumb() doesn’t add to it.

How it hooks in

  • window.fetch and XMLHttpRequest.prototype.open and send are wrapped.
  • history.pushState and replaceState are wrapped.
  • The console methods are wrapped when consoleMessages is on.
  • Errors, rejections and interactions use event listeners; timings use PerformanceObserver.

logger.shutdown() removes all of them and restores the originals.