Skip to content

Browser widget

The HumanPass widget is a framework-independent Web Component. Load it from the versioned Valgix URL and provide your public sitekey.

<script
src="https://humanpass.valgix.com/widget/v0/humanpass.min.js"
defer
></script>
<humanpass-widget
data-humanpass-sitekey="hp_site_live_REPLACE_ME"
data-humanpass-action="signup"
required
></humanpass-widget>

Use /widget/v0/ to load the current pre-release widget.

data-humanpass-sitekey is the only required configuration value. It is public and safe to include in HTML.

data-humanpass-action is optional. It defaults to default and must match the site’s Allowed actions policy.

Choose Checkbox, Non-interactive, or Invisible in the Valgix dashboard. The widget retrieves that setting from HumanPass after validating the browser origin.

There is no supported data-humanpass-mode attribute. This prevents browser markup from weakening the site’s configured presentation.

Visible widgets use the standard 300 × 65 px layout by default and shrink safely inside narrower containers. To fill the available width of a form or card, use:

<humanpass-widget
data-humanpass-sitekey="hp_site_live_REPLACE_ME"
data-humanpass-size="flexible"
></humanpass-widget>

HumanPass keeps its Valgix branding and the built-in Privacy and Help links in both layouts.

HumanPass uses the light theme by default. Add the theme attribute when the widget is placed on a dark surface:

<humanpass-widget
data-humanpass-sitekey="hp_site_live_REPLACE_ME"
data-humanpass-theme="dark"
></humanpass-widget>

The component creates a hidden input named humanpass-token. Customize the field name if needed:

<humanpass-widget
data-humanpass-sitekey="hp_site_live_REPLACE_ME"
data-humanpass-hidden-field-name="verification-response"
required
></humanpass-widget>

Read the same field on your backend and verify it before processing the form.

Use DOM events instead of inline handlers:

const widget = document.querySelector("humanpass-widget");
widget.addEventListener("solve", () => {
updateVerificationStatus("Verification complete");
});
widget.addEventListener("error", (event) => {
showRetryMessage(event.detail.message);
});
widget.addEventListener("expire", () => {
showExpiredMessage();
});

The form’s hidden field carries the response to your backend. Keep response tokens out of logs and analytics.

Add data-humanpass-prefetch to a Checkbox widget to start fetching its challenge when a visitor hovers over or focuses the widget. The widget waits for activation before solving the challenge. Prefetch is intended for pages where visitors typically complete the checkbox after approaching it.

Set data-humanpass-lang for built-in localization or override individual labels with data-humanpass-i18n-* attributes. See the Widget API reference for the complete attribute list.

Allow the versioned widget script and HumanPass API connection:

Content-Security-Policy:
default-src 'self';
script-src 'self' https://humanpass.valgix.com;
connect-src 'self' https://humanpass.valgix.com;
worker-src 'self' blob:;

Merge these directives into your existing policy rather than replacing it.

With a nonce-based policy, provide your page’s script and style nonces through window.HUMANPASS_SCRIPT_NONCE and window.HUMANPASS_CSS_NONCE before the widget initializes. Test the integration against your production policy and browser targets.

You can place multiple widgets on one page. Give each widget the action for the operation it protects, and verify the matching expected action on your backend.