Skip to main content
Integrating Verisoul in web browsers is straightforward and requires minimal code changes. This guide covers everything you need to implement Verisoul’s fraud prevention in your web application.

Installation

For production web integrations, we strongly recommend setting up a custom hostname and loading the SDK from your own subdomain. Without a custom hostname, 4-6% of traffic may be blocked by ad blockers or privacy extensions.

Script Tag Installation

Place the script tag in the <head> as early as possible so the Verisoul object is available on the window before you call Verisoul functions. Use the tag for your environment. Sandbox
Production
With a custom hostname, replace js.verisoul.ai with your hostname in both tags. For js.example.com, production loads from js.example.com and sandbox loads from sandbox.js.example.com.

Script Tag Parameters

  • {sandbox_project_id}: The ID of your Sandbox project
  • {production_project_id}: The ID of your Production project
Each tag carries its project ID twice: in the project_id query parameter on the script URL and in the verisoul-project-id attribute. Set the same value in both. The async attribute loads the script in the background, so page rendering continues while it downloads. Add this helper right after the script tag. It makes the Verisoul object available on the window immediately, so you can call Verisoul functions before the script finishes loading. The helper is optional and generally makes the integration easier.

Synchronous Installation

For a simpler integration, remove async from the script tag and leave out the helper. The browser then pauses page rendering until the script loads, and the Verisoul object is available on the window right after.

Project ID in the Script URL

With the project ID in the script URL, Verisoul knows which project the page belongs to when the browser requests the script. Project-specific features can then start while the script loads. The SDK reads the verisoul-project-id attribute once it runs, so keep both. Script tags that only set the attribute still work. Add the query parameter the next time you update your integration. The script request returns a 400 when the ID in the URL is unknown or belongs to the other environment, and the SDK fails to load. If Verisoul is missing from the window, check the script request in your browser’s network tab.

Content Security Policy (CSP)

If your application has a Content Security Policy, update it to allow the SDK. The SDK loads scripts, opens connections and creates hidden iframes, so it needs script-src, worker-src, connect-src and frame-src. With a custom hostname, the SDK script and most of its traffic go through your hostname. A few runtime connections and one hidden iframe still use *.verisoul.ai, so allow both:
If you are using the Verisoul-hosted SDK URL before your custom hostname is active, allow the Verisoul domains instead:
A CSP that blocks part of the SDK does not make Verisoul.session() or the Authenticate API fail. Both still succeed, but the blocked signals are missing from the session. If your CSP has no frame-src (or child-src), iframes fall back to default-src, which usually blocks them. Check the browser console for CSP violations that mention verisoul.ai after you deploy.

Usage

Once installed, you can use the SDK to get the current session_id when you need to make a prediction.

session()

Verisoul generates a session_id to uniquely identify each user session. The session_id is required when you need to get a risk prediction from the backend API and must be passed from your client to the server. You can get the current session_id at any time by calling Verisoul.session(). The function returns a promise that resolves once Verisoul collects a minimum amount of session information to make a prediction. Important: Each session_id expires after 24 hours and cannot be used to call the backend API after expiration. It is recommended to only get a session_id right before you need to make a server-side request. Example usage:

account()

account() is off by default and sits outside the recommended Verisoul integration. Calls from the browser are unauthenticated, so anyone with your Project ID can make them. For production and for real-time fraud prevention, use the authenticate API from your server.
The account() function sends account information to Verisoul directly from the browser. It exists for pilots and evaluation, before a server-side integration is in place.

What to know before you turn it on

  • Unauthenticated: The call is protected only by your Project ID, which is public in your page’s script tag. Anyone who has it can attach any account ID to a session, or add an account to a list such as allow or block.
  • Dashboard only: Data sent with account() appears in the Verisoul dashboard. Your application receives decisions and scores only through the server-side API.

Turning it on

1

Open the project's settings

In the dashboard, go to Settings → Projects, select the project, and open the Project Settings tab.
2

Turn on Client-side account()

A dialog describes what the setting allows.
3

Acknowledge and confirm

Tick the box confirming you understand that account data sent from the browser is unauthenticated, then choose Turn on. Verisoul starts accepting calls for the project within about a minute.
Changing the setting needs Change SDK settings, which by default only Admins hold. Sandbox and Production are set separately. See Projects and Usage. While the setting is off, account() still resolves and Verisoul ignores the data. Your page sees no error, and the session stays without an account. Projects created before November 19, 2026 have the setting on. Turn it off for any project that only uses the server-side integration.

Usage

The function accepts the Account Object, the same object used in the authenticate API. Only the id field is required.
When you move to the server-side integration, turn the setting off.

Next Steps