HumanBehavior SDK provides high-fidelity session recordings that capture every user interaction on your website.

Automatic Session Recording

The SDK automatically starts recording when initialized:
import { HumanBehaviorTracker } from 'humanbehavior-js';
const tracker = HumanBehaviorTracker.init('your-api-key');
No manual start() call is required with the init() method. The SDK automatically begins recording user interactions.

What Gets Recorded

  • Mouse: Movements, clicks, hovers, drag & drop
  • Keyboard: Text input, shortcuts, copy/paste, form submissions
  • Console: Logs, warnings, errors (automatically recorded)
  • Viewport: Scrolls, resizes, element visibility

Session Persistence

Sessions automatically persist across page reloads, navigation, and short inactivity (15-minute window). A new session is created after 15+ minutes of inactivity or browser restart.

Session ID

Each session gets a unique ID:
const sessionId = tracker.getSessionId();

Performance

Events are automatically batched and sent every few seconds to reduce network requests and improve performance.

Properties & Options

Property/OptionTypeDescription
apiKeystringYour project’s API key (required).
redactFieldsstring[]CSS selectors for fields to redact.
enableAutomaticTrackingbooleanEnable/disable automatic event tracking (default: true).
automaticTrackingOptionsobjectFine-tune automatic tracking (see below).
sessionIdstringUnique session ID for the current user session.
getSessionId()functionReturns the current session ID.
automaticTrackingOptions fields:
OptionTypeDescription
trackButtonsbooleanTrack button clicks (default: true).
trackLinksbooleanTrack link clicks (default: true).
trackFormsbooleanTrack form submissions (default: true).
includeTextbooleanInclude button/form text in event properties.
includeClassesbooleanInclude CSS classes in event properties.

Example Usage

import { HumanBehaviorTracker } from 'humanbehavior-js';

const tracker = HumanBehaviorTracker.init('your-api-key', {
  redactFields: ['input[type="password"]', '.sensitive'],
  enableAutomaticTracking: true,
  automaticTrackingOptions: {
    trackButtons: true,
    trackLinks: true,
    trackForms: true,
    includeText: true,
    includeClasses: false
  }
});