[C] Consentify

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

Add the script tag to your HTML page, before the closing </body> tag:

<script
  src="https://consentify.dev/widget.js"
  data-site-id="YOUR_SITE_ID"
  data-position="bottom-right"
  data-theme="auto"
  data-accent="#3b82f6"
></script>

The widget automatically initializes when the DOM is ready. The API base URL is auto-detected from the script's src attribute.

How It Works

  1. The script loads and reads the data-site-id attribute
  2. Checks for an existing consent cookie - if found, skips the rest (fast path)
  3. Fetches your site config from GET /api/consent/config/:siteId
  4. Initializes @consentify/core with your categories for policy-versioned storage
  5. Renders the consent banner with your categories and theme settings
  6. When the visitor makes 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.

Browser Support

  • Chrome 64+
  • Firefox 62+
  • Safari 12+
  • Edge 79+

On this page