Skip to main content

window.ConsentShield API Reference

Control banner states and listen for real-time user consent changes directly in your Single Page Application (SPA).

// 1. Trigger the Preferences Modal
window.ConsentShield.openPreferences();

// 2. Query Consent State for a Category
const isAllowed = window.ConsentShield.hasConsent('marketing'); // boolean

// 3. Listen to Consent Updates
window.ConsentShield.on('consent_updated', (event) => {
console.log('Consent updated:', event.categories);
console.log('Cryptographic Proof:', event.proof_hash);
});