Behavioral Biometrics

v2.1.0 · Human behavior pattern analysis generating ~165 bits of unique entropy from mouse movements, keyboard typing rhythm, scroll behavior, and touch interactions.

Privacy note: The engine does not record actual keystrokes — it only captures timing patterns (key hold duration, inter-key intervals). Single characters are anonymized as "char"; only special keys (Shift, Enter, etc.) retain their names.

Public API — window.__behavioralV2

MethodReturnsDescription
start()voidBegin 5-second data collection
stop()voidStop collection early
getData()ObjectGet raw behavioral data (mouse, keyboard, scroll, touch)
generateFingerprint(data)string8-character behavioral hash from collected data
hasEnoughData()booleanWhether minimums are met for fingerprinting
getState()ObjectCurrent collection state (counts, timing)

Collection Configuration

ParameterValueDescription
collectionDuration5,000msAuto-stop after 5 seconds
maxEventsPerType100Cap per event type to prevent payload overflow
minMouseEvents10Minimum mouse events for valid fingerprint
minKeyEvents5Minimum keyboard events
minScrollEvents3Minimum scroll events

Collected Data Points

Mouse Events

FieldTypeSource
x, ynumberclientX / clientY
movementX, movementYnumberPointer delta
timestampnumberDate.now()
typestring"move" | "click"
buttonnumberClick button index (clicks only)

Keyboard Events

FieldTypeSource
keystring"char" (anonymized) or special key name
durationnumberKey hold time (keydown → keyup) in ms
timestampnumberDate.now() at keyup

Scroll Events

FieldTypeSource
scrollYnumberAbsolute scroll position
deltaYnumberScroll delta per event
timestampnumberDate.now()

Touch Events

FieldTypeSource
x, ynumberTouch position
forcenumberTouch pressure (0–1, device-dependent)
typestring"start" | "move"
timestampnumberDate.now()

Pattern Analysis Metrics

The tracking engine (tracking.js) performs advanced analysis on the raw data before sending it to the backend:

Mouse Metrics

{
  avgVelocity: 0.85,          // px/ms average cursor speed
  velocityVariance: 0.23,     // Speed consistency
  avgAngleChange: 0.42,       // Radians avg direction change
  clickCount: 3,
  moveCount: 47,
  straightLineRatio: 0.15     // % of near-straight movements
  // Bot indicator: straightLineRatio > 0.8
}

Keyboard Metrics

{
  avgInterval: 185.3,         // ms between keystrokes
  intervalVariance: 2450.1,   // Typing rhythm consistency
  avgKeyDuration: 72.5,       // ms key hold time
  durationVariance: 890.2,
  keyCount: 23,
  suspiciouslyRegular: false  // true if variance < 10 (bot)
}

Scroll Metrics

{
  avgDelta: 53.2,             // Average scroll delta
  deltaVariance: 1205.8,
  avgInterval: 312.5,         // ms between scroll events
  intervalVariance: 8920.3,
  eventCount: 8,
  uniformDelta: false         // true if all deltas identical (bot)
}

Fingerprint Generation

The behavioral fingerprint is an 8-character hex hash derived from:

signature = [
  mouseVelocity.toFixed(2),
  keyboardRhythm.toFixed(2),
  scrollPattern.toFixed(2),
  touchSignature.toFixed(2),
  mouseEventCount,
  keyboardEventCount,
  scrollEventCount,
  touchEventCount
].join('|');

hash = simpleHash(signature) → 8-char hex

Integration with Tracking Engine

// Automatic flow (triggered by tracking.js):
1. tracking.js sends main event (t=0s)
2. tracking.js calls __behavioralV2.start() (t=0s)
3. Behavioral engine collects for 5s (t=0-5s)
4. tracking.js reads data at t=6s
5. If hasEnoughData() → POST /t with behavioral payload

// The behavioral payload is sent as a SEPARATE request
// with action: "behavioral_analysis"

Backward Compatibility

Legacy globals are maintained for older integrations:

window.__trackBehavioral = startCollection;     // Legacy alias
window.__getBehavioralData = getBehavioralData;  // Legacy alias
window.__behavioralData → getBehavioralData();   // Getter (copy)