DIWALI:3 Months Free (Starter & Growth)Claim 1+3 →
++
CLIENT ARCHITECTURE · CP.MIN.JS

Sub-12KB Consent Banner SDK with Script Blocking.

Zero dependencies. Zero main-thread drag. Intercepts script tags before DOM paint and dispatches Google Consent Mode v2 signals in sub-2ms.

PERFORMANCE BENCHMARKS

Engineered for Zero Core Web Vitals Latency

++++

Bundle Footprint

< 11.8 KB

Gzipped production payload with 0 external npm or third-party dependencies.

++++

INP & LCP Overhead

0 ms Drag

Executes via non-blocking asynchronous micro-tasks without freezing main UI thread.

++++

Edge CDN Latency

< 15 ms TTFB

Served from 300+ global edge POPs with strict TLS 1.3 encryption and HSTS headers.

ONE-LINE HTML EMBED

<script
  src="https://cdn.consentplix.com/cp.min.js"
  data-site-token="YOUR_SITE_TOKEN"
  data-api-base="https://api.consentplix.com"
></script>

What the consent SDK does

The ConsentPlix SDK is a single script, cp.min.js, that you add to your site's head. It is about 13KB minified and about 5KB compressed, with no dependencies. On every page load it:

  1. Sets Google Consent Mode v2 defaults to "denied" so Google tags wait for a choice.
  2. Holds back known trackers, including Google Tag Manager and Analytics, Meta Pixel, Microsoft Clarity, Hotjar, TikTok, Mixpanel and Segment, until the visitor allows them.
  3. Loads your site's notice, languages and banner style from the ConsentPlix API.
  4. Shows the banner to new visitors, or applies the saved choice for returning visitors.
  5. Records each choice with the hash of the notice shown, signs it and stores it in the consent ledger.

Install

<script
      src="https://cdn.consentplix.com/cp.min.js"
      data-site-token="YOUR_SITE_TOKEN"
      data-api-base="https://api.consentplix.com"
    ></script>

Place it above other analytics and marketing scripts. Framework examples for Astro, Next.js, React and WordPress are in the quickstart.

Built-in banner or your own

In Standard mode the SDK draws a banner using your brand colours, position and languages from the console. In Headless Pro mode it draws nothing and wires up your own HTML instead, through attributes such as data-cp-banner, data-cp-accept="all", data-cp-reject="essential" and data-cp-toggle="analytics". This website's own consent banner runs on Headless Pro.

Categories and blocking

The SDK uses three categories: essential (always on), analytics and marketing. To hold back any script until consent, set type="text/plain" and data-cp-category. For iframes such as YouTube, use data-cp-src in place of src. See cookie and tracker blocking.

Privacy signals and re-consent

  • If a visitor's browser sends Global Privacy Control or Do Not Track and they have not chosen before, the SDK applies essential-only consent.
  • When you change your notice, its hash changes and returning visitors are asked again, so every record matches the notice the person actually saw.
  • Withdrawing consent clears the saved choice, records the withdrawal and reloads the page without the blocked scripts.

Listen for changes

Each choice fires a cp_consent_updated browser event and a matching dataLayer event for Google Tag Manager, with the granted and denied categories.