Console & network capture
enableConsoleTracking / enableNetworkTracking — what is captured, endpoints, and privacy.
Options
| Option | Default | Meaning |
|---|---|---|
enableConsoleTracking | true | Patch console.log / warn / error; ingest only warn and error |
enableNetworkTracking | true | Intercept fetch and XHR failures / long loads |
captureRequestBodies | false | Opt-in redacted bodies/headers on error-correlated requests (not every network row) |
HumanBehaviorTracker.init(apiKey, {
enableConsoleTracking: true,
enableNetworkTracking: true,
captureRequestBodies: false,
});Both console and network tracking are opt-out (enabled unless set to false).
Console
Behavior
When enabled, the SDK wraps:
console.log— forwarded to the browser console only (not sent to HumanBehavior)console.warn— forwarded and ingestedconsole.error— forwarded and ingested
Only warn and error payloads are POSTed to:
POST /api/ingestion/logs
Authorization: Bearer <apiKey>Logs fired before the minimum-duration gate opens are queued and flushed later (same 5s default as other traffic).
Where it appears
| Surface | Tab / page |
|---|---|
| Replay player | Activity → Console |
| Insights | Logs |
| Issues | Console breadcrumbs on error reports |
Safety
Anything you console.warn / console.error can be stored. Do not log access tokens, password fields, or raw PII on those levels. Disable with enableConsoleTracking: false in sensitive apps, or filter at the application layer before logging.
Network
What is tracked
| Signal | Condition |
|---|---|
| HTTP error | fetch/XHR status outside 2xx–3xx |
| Network failure | status 0 / failed request |
| Long loading | Request still in flight after 10s (errorType: long_loading) |
Successful 2xx–3xx responses are not shipped as network-error rows; metadata of the latest success may still be kept briefly for error correlation (within 10s of a subsequent crash).
Skip list
Requests to HumanBehavior ingestion URLs (and related SDK traffic) are skipped via shouldSkipNetworkTracking so the SDK does not observe itself.
Endpoint
POST /api/ingestion/network
Authorization: Bearer <apiKey>Typical fields include url, method, status, duration, errorType, sessionId, span-oriented attributes (http.method, http.url, http.status_code), and automatic properties when enabled.
XHR + fetch
Both window.fetch and XMLHttpRequest are instrumented for failure paths so SPA clients using either transport are covered.
Bodies / headers
Bodies and headers are not attached to routine network-error rows unless you opt into captureRequestBodies for the error-correlation path. When opted in, values pass through redaction helpers before attach.
Breadcrumbs
Network and console activity also feed the error breadcrumb buffer (click | navigation | console | network) used by Error monitoring.
Verify
- Trigger
console.error("hb-test")and a failing API call in a real session. - Open the replay → Console / Network tabs.
- Confirm
/api/ingestion/logsand/api/ingestion/networkreturn 2xx. - Optionally open Insights → Logs for aggregate views.