SDKs
Browser SDK (JS/TS)
Complete reference for the VerifyStack Browser SDK — initialization, methods, signals, and TypeScript types.
The Browser SDK collects device signals, behavioral biometrics, and browser fingerprints automatically, then sends them to the VerifyStack API for real-time fraud scoring.
Initialization
Constructortypescript
// Option A: Script tag (IIFE)
// <script src="https://verifystack.io/sdk/browser.js"></script>
// window.VerifyStack is available globally
// Option B: ES module
import { VerifyStack } from 'https://verifystack.io/sdk/browser.mjs';
const vs = new VerifyStack({
apiKey: 'pk_live_xxxxxxxxx',
endpoint: 'https://verifystack.io',
timeout: 8000,
debug: false,
// Optional collectors (all default to true):
// collectBehavior, collectHologram, collectIdentity,
// collectStealth, collectTiming
});vs.decide(options)
Collects signals and returns a fraud decision.
decide()typescript
interface DecideOptions {
userId: string; // Your internal user ID (required)
action: string; // 'login' | 'signup' | 'trial_start' | 'checkout' | 'purchase' | 'transfer' | 'password_change' | 'custom'
email?: string; // User email for correlation
sessionId?: string; // Optional session identifier
amount?: number; // Transaction amount
currency?: string; // ISO 4217 currency code
metadata?: Record<string, unknown>;
}
interface DecideResponse {
decision: 'allow' | 'challenge' | 'deny';
score: number; // 0-100
confidence: number; // 0.0-1.0
confidencePercent: number; // 0-100
reasons: string[];
evidenceId: string; // For forensic review
requestId: string; // For feedback API
processingTimeMs: number; // ms
}
const result: DecideResponse = await vs.decide({
action: 'login',
userId: 'user_123'
});vs.collect()
Collects SDK signals without requesting a fraud decision.
collect()typescript
interface CollectionResult {
device: DeviceSignals;
behavior: BehaviorSignals | null;
hologram: HologramToken | null;
bio: BioToken | null;
deepIdentity: DeepIdentityToken | null;
stealth: StealthToken | null;
hardwareTiming: HardwareTimingSignals | null;
visitorId: string;
collectedAt: number;
durationMs: number;
}
const signals: CollectionResult = await vs.collect();
console.log(signals.visitorId);vs.sendBeacon(options)
Sends fire-and-forget payloads with navigator.sendBeacon().
sendBeacon()typescript
vs.sendBeacon({ action: 'custom', userId: 'user_123' });Other Methods
| Method | Description |
|---|---|
| vs.startTracking() | Start tracking user behavior (mouse, keyboard, scroll, touch) |
| vs.stopTracking() | Stop tracking and clean up event listeners |
| vs.markFormStart() | Mark the start of a form interaction |
| vs.markHoneypot() | Mark honeypot field as filled (bot detection) |
| vs.getVisitorId() | Get persistent visitor ID without full collection |
| vs.clearCache() | Clear the signal cache |
| vs.resetBehavior() | Reset behavior tracking data |
| vs.destroy() | Destroy SDK instance, clean up all resources |
Collected Signals
The SDK automatically collects signals across these categories. No manual setup is required.
| Category | Signals | Spoofing Resistance |
|---|---|---|
| Browser | User agent, language, plugins, WebGL, Canvas, AudioContext | Medium |
| Hardware | Screen size, CPU cores, device memory, touch, sensors | High |
| Network | Connection type, downlink speed, RTT | Medium |
| Behavior | Mouse movement, typing patterns, scroll velocity | Very High |
| Environment | Timezone, installed fonts, platform inconsistencies | Medium |
Behavioral signals are collected passively during the session. For best accuracy, initialize the SDK as early as possible on the page.