OptinStack Documentation
Consent Management Platform SDK — privacy-compliant consent banners with script blocking, Google Consent Mode v2, and GPC support.
OptinStack is a lightweight, privacy-first Consent Management Platform (CMP) SDK. It renders a consent banner and preferences dialog inside a Shadow DOM, manages user consent state, blocks and unblocks third-party scripts and iframes, syncs consent records to a server, and integrates with Google Consent Mode v2 and Global Privacy Control (GPC).
Key Features
Script & Iframe Blocking
Automatically blocks and unblocks third-party scripts and iframes based on user consent using MutationObserver.
Google Consent Mode v2
Native integration with Google Tag Manager consent mode — no additional configuration needed.
JavaScript API
Full programmatic control over consent state, UI visibility, and event handling via window.OptinStack.
GPC Support
Automatically respects Global Privacy Control signals from the browser.
Quick Start
Add the OptinStack script to your page — the server injects your project configuration and serves the runtime bundle:
<script src="https://api.optinstack.com/banner/{siteId}.js" defer></script>Once loaded, the SDK is available at window.OptinStack:
window.OptinStack = window.OptinStack || [];
window.OptinStack.push(function (os) {
console.log('Consent state:', os.consent.get());
});The callback queue pattern ensures your code runs after the SDK initializes, even if your script loads before the OptinStack bundle.