Behavioral Biometrics
Behavioral biometrics analyze how users interact with your site - typing patterns, mouse movements, and touch gestures.
Enabling Biometrics
const simplr = new SimplrFraud({
collectBiometrics: true,
autoStart: true
});
Keystroke Dynamics
Analyzes typing patterns to create a behavioral profile:
const behavior = simplr.collectBehaviorSignals();
console.log(behavior.keystroke);
// {
// avg_delay: 125, // ms between keystrokes
// delay_std_dev: 45, // variation in timing
// avg_hold_time: 95, // how long keys are held
// typing_speed: 6.5, // characters per second
// correction_rate: 0.05, // backspace/delete ratio
// keystroke_count: 42, // total keystrokes
// paste_count: 0 // paste events detected
// }
What Keystroke Analysis Reveals
| Metric | Fraud Indicator |
|---|---|
| Very fast typing | Copy-paste, automated input |
| No variation (std_dev=0) | Bot or autofill |
| High correction rate | Unfamiliar with data |
| Very slow typing | Manual data entry from another source |
Tracking Specific Fields
For better accuracy, track specific form fields:
const simplr = new SimplrFraud({ collectBiometrics: true });
// Method 1: Using trackInput
const emailInput = document.getElementById('email');
const props = simplr.trackInput('email');
emailInput.addEventListener('input', props.onInput);
emailInput.addEventListener('keydown', props.onKeyDown);
emailInput.addEventListener('keyup', props.onKeyUp);
// Method 2: React hook
const { trackInput } = useSimplrForm();
<input type="email" {...trackInput('email')} />
Mouse Tracking
Analyzes mouse movement patterns:
console.log(behavior.mouse);
// {
// avg_velocity: 450, // pixels per second
// avg_acceleration: 1200, // pixels per second²
// acceleration_variance: 350,
// total_distance: 12500, // total pixels traveled
// direction_changes: 45, // number of direction changes
// straightness_ratio: 0.72, // how direct movements are
// click_count: 5,
// click_intervals: [1200, 800, 2500], // ms between clicks
// scroll_count: 8,
// scroll_speed_avg: 250
// }
What Mouse Analysis Reveals
| Metric | Fraud Indicator |
|---|---|
| No mouse movement | Mobile device or keyboard-only bot |
| Perfectly straight lines | Automated movement |
| Very high velocity | Teleporting cursor |
| Identical click intervals | Scripted behavior |
| Low direction changes | Not human-like exploration |
Touch Tracking
For mobile and touch devices:
console.log(behavior.touch);
// {
// avg_pressure: 0.5,
// pressure_std_dev: 0.15,
// avg_radius: 25,
// avg_touch_duration: 150,
// swipe_velocity_avg: 800,
// touch_count: 12,
// multi_touch_count: 0
// }
Form Fill Time
How long it takes to complete a form:
console.log(behavior.form_fill_time_ms); // 45000 (45 seconds)
| Fill Time | Interpretation |
|---|---|
| < 2 seconds | Automated or autofill |
| 2-10 seconds | Autofill with minor edits |
| 10-60 seconds | Normal human input |
| > 60 seconds | Distracted or unfamiliar |
Starting and Stopping Collection
const simplr = new SimplrFraud({ collectBiometrics: true });
// Start tracking (automatic if autoStart: true)
simplr.startTracking();
// Stop tracking
simplr.stopTracking();
// Reset collected data
simplr.reset();
Full Behavior Response
interface BehaviorSignals {
keystroke: {
avg_delay: number; // ms
delay_std_dev: number; // ms
avg_hold_time: number; // ms
typing_speed: number; // chars/second
correction_rate: number; // 0-1
keystroke_count: number;
corrections_count: number;
paste_count: number;
total_typing_time_ms: number;
};
mouse: {
avg_velocity: number; // px/s
avg_acceleration: number; // px/s²
acceleration_variance: number;
total_distance: number; // px
direction_changes: number;
straightness_ratio: number; // 0-1
click_count: number;
click_intervals: number[]; // ms
scroll_count: number;
scroll_speed_avg: number;
movement_count: number;
};
touch: {
avg_pressure: number; // 0-1
pressure_std_dev: number;
avg_radius: number; // px
avg_touch_duration: number; // ms
swipe_velocity_avg: number;
touch_count: number;
multi_touch_count: number;
};
form_fill_time_ms: number;
}
Privacy Considerations
- No actual keystrokes or content is captured
- Only timing and movement patterns
- Data is aggregated, not raw events
- Compliant with GDPR when disclosed