Developer pages

Console & network capture

enableConsoleTracking / enableNetworkTracking — what is captured, endpoints, and privacy.

Options

OptionDefaultMeaning
enableConsoleTrackingtruePatch console.log / warn / error; ingest only warn and error
enableNetworkTrackingtrueIntercept fetch and XHR failures / long loads
captureRequestBodiesfalseOpt-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 ingested
  • console.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

SurfaceTab / page
Replay playerActivity → Console
InsightsLogs
IssuesConsole 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

SignalCondition
HTTP errorfetch/XHR status outside 2xx–3xx
Network failurestatus 0 / failed request
Long loadingRequest 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.

Network and console activity also feed the error breadcrumb buffer (click | navigation | console | network) used by Error monitoring.

Verify

  1. Trigger console.error("hb-test") and a failing API call in a real session.
  2. Open the replay → Console / Network tabs.
  3. Confirm /api/ingestion/logs and /api/ingestion/network return 2xx.
  4. Optionally open Insights → Logs for aggregate views.