Widget Installation
Add the Consentify consent banner to any website with a single script tag.
The Consentify widget is a lightweight consent banner built in vanilla TypeScript. It uses @consentify/core internally for cookie-based consent storage with policy versioning and multi-tab sync.
Looking for more control? See SDK (npm) for programmatic integration or Shadcn Registry for a customizable React component.
Installation
Copy the snippet from your dashboard. It uses a public token:
<script
src="https://consentify.dev/widget.js"
data-token="ct_YOUR_PUBLIC_TOKEN"
data-position="bottom-right"
data-theme="auto"
data-accent="#3b82f6"
></script>The widget initializes automatically once the DOM is ready. The API base URL is
auto-detected from the script's src attribute.
Token mode is the recommended integration. The token is a single opaque, rotatable credential, its config response is CDN-cached, and requests are validated against your site's registered domain.
Site ID mode (legacy)
The widget also accepts data-site-id with your raw site UUID. It still works
and remains supported for existing installs, but it exposes the site's database
identifier and is not cached as aggressively. Prefer data-token for new
sites.
<script
src="https://consentify.dev/widget.js"
data-site-id="YOUR_SITE_ID"
></script>How It Works
- The script reads
data-token(ordata-site-idin legacy mode) - Checks for an existing consent cookie - if found, and the page has no blocked scripts and Google Consent Mode is off, skips the rest (fast path)
- Fetches the site config:
GET /api/gateway?token=...in token mode, orGET /api/consent/config/:siteIdin site ID mode - Initializes
@consentify/corewith your categories for policy-versioned storage - Renders the consent banner with your categories and theme settings
- On a choice, stores consent in a cookie and records the event via
POST /api/consent/events
If the visitor already has a valid consent cookie, the banner is not shown. If you change your consent categories in the dashboard, the policy hash changes and visitors are prompted again.
Global Privacy Control
When a visitor's browser sends the Global Privacy Control
signal (navigator.globalPrivacyControl) and they have no stored decision, the
widget treats it as reject-all for every non-required category: no banner is
shown, blocked scripts stay blocked, and the consent record is stored with
source: "gpc" as proof the signal was honored. A stored decision always wins
over the signal. On by default; disable per site in Customizer → Advanced →
"Respect Global Privacy Control".
Browser Support
- Chrome 64+
- Firefox 62+
- Safari 12+
- Edge 79+