Welcome
Developer guides for the OptinStack consent runtime, JavaScript API, and platform integrations.
OptinStack is a Consent Management Platform (CMP) runtime for websites. It renders a consent banner and preferences dialog inside a Shadow DOM, manages visitor consent state, blocks and unblocks third-party scripts and iframes, and records consent updates for reporting.
This site documents the browser runtime, JavaScript API, consent events, and integration patterns for developers adding OptinStack to a site. Product setup, compliance guides, and platform walkthroughs live on optinstack.com.
Key topics
Install
Add the OptinStack runtime script to your site.
JavaScript API
Read and update consent state through window.OptinStack.
Banner control
Open preferences, reset consent, custom flows, and iframe placeholder messaging.
Events
Subscribe to consent changes, blocking events, and reporting errors.
Consent cookie
Understand stored consent state and sharing across subdomains.
Google Consent Mode
How OptinStack drives gtag Consent Mode v2 and dataLayer events.
Quick start
Add the OptinStack script to your page. It loads the consent runtime, which fetches your project configuration and renders the banner:
<script
src="https://api.optinstack.com/v1/js/runtime/stable/optinstack.js"
data-optinstack-site="{projectId}"
></script>Once loaded, the API is available at window.OptinStack:
await window.OptinStack.ready;
console.log(window.OptinStack.choices);Replace {projectId} with your project ID from the dashboard. See Getting started for
installation details.
Was this helpful?