Skip to main content
load() imports the browser agent and resolves to a ShieldLabsAgent. Loading alone does not start an identification.

Options

string
required
Your domain’s Public Key from Integration > API keys. Replace PUBLIC_API_KEY with that value. The SDK accepts 1–128 letters, digits, underscores or hyphens. It rejects server secrets beginning with sec_ or whsec_.
"production" | "development"
default:"production"
Selects the production or development agent host. Production loads https://cdn.shieldlabs.ai/snippet.js; development loads https://dev.cdn.shieldlabs.ai/snippet.js.This selects a ShieldLabs service environment. For your own staging site, use a separate registered domain with production services.
number
default:"10000"
Milliseconds to wait for loading. Also sets the default timeout for agent calls. Must be greater than 0 and at most 2,147,483,647.
string
Advanced override for the agent module URL. Must be an absolute HTTPS URL; HTTP is accepted only for localhost and 127.0.0.1. Overrides the host selected by environment. The SDK replaces any existing publicKey query parameter and removes the URL fragment.Use only an endpoint configured for your integration. See the CDN loading guidance.

Return value

Promise<ShieldLabsAgent> resolves to an object with identify(), check() and identifyOnInteraction(). Concurrent and repeated loads of the same resolved URL share one module import. Failed imports are retried by a later load() call. A timeout ends the wait; it does not cancel an import already in progress.

Errors

load() rejects with invalid_options, unsupported_environment, load_failed or timeout. Call it in a browser page over HTTPS or localhost, after any consent gate your integration requires. Server rendering and workers are unsupported. See error handling for the error fields and recovery steps.