Skip to main content
The Fraud Insights SDK collects device and behavioral signals in the background and sends them to Youverify’s Behavioral Service to enrich the risk score. It applies to all platforms, web and mobile, and your users never see it.
This guide applies to every platform you use Fraud Insights on, not just web. The session model, events and configuration below are the same everywhere. The installation steps and code examples use the JavaScript package, youverify-behavioral-web-sdk, which you can add to any web application.

Features

  • Session management: automatic session IDs and start and end tracking.
  • Device and behavioral signals: powered by FingerprintJS and browser heuristics.
  • Event tracking: send custom events with optional user or entity IDs and metadata.
  • Typed responses: a rich GetDeviceResponse structure for risk analysis.

Installation

Import the SDK in your application:

Configuration

Create an instance with new YouverifyBBS(props):

Props

string
required
Your Public Merchant Key. You can find it in the API / Webhook section of your Youverify dashboard. It is safe to use in client-side code.
string
required
Logical name of the integrating application.
boolean
default:"true"
true uses the sandbox (staging) environment. false uses production.
(result: GetDeviceResponse) => void
Called after a successful signal response, for example after get().
(error: Error) => void
Called whenever the SDK encounters an error.
(sessionId: string) => void
Called when a session is initialized.
() => void
Called when close() completes and the session ends.

Core API

get(entityId?)

Initializes or resumes a session and sends the initial signal. Returns Promise<void>.
  • The first call sends a session_start event.
  • Later calls in the same session send a “Session resumed” custom event.
  • It triggers onLoad(result: GetDeviceResponse) with the full device and session data.

sendEvent(eventTitle, entityId?, meta?)

Sends a custom behavioral event for the current session. Returns Promise<void>.

close(entityId?)

Sends a session_end event and clears the local session state. Returns Promise<void>.

getSessionId()

Returns the current session ID, or null if there is none.

getSessionDuration()

Returns the time in milliseconds since the session started.

Environments

The SDK chooses backend URLs from the build configuration and the sandboxEnvironment flag. Use the Public Merchant Key from the API / Webhook section of your dashboard, and make sure it matches the environment you are using.

Usage examples

Script tag (UMD)

React

Browser support

  • Modern browsers with ES2015+ support.
  • Requires the Fetch API, or a polyfill.
Always use the correct Public Merchant Key as your publicKey for the environment (sandbox or production). Use meaningful event names and attach meta data for richer analytics.