Developer Quickstart Guide
Deploy enterprise consent management, real-time pixel suppression, and cryptographic lawsuit defense in under 5 minutes.
>_
Client JS SDK
Direct programmatic modal triggers, event bindings, and React / Next.js hooks.
§ 631
CIPA Litigation Defense
Pre-DOM network interception, SHA-256 consent ledgers, and forensic exports.
Step 01: Embed the Real-Time Kernel
Insert the following <script> tag as the first script inside your website's <head> tag. Positioning it before Google Tag Manager, Meta Pixels, or TikTok tags ensures 100% pre-DOM interception.
<!-- Consent Shield Real-Time Defense Kernel -->
<script
src="https://consentshieldai.com/shield.js"
data-site-id="CS-LIVE-PROD"
data-gcm-v2="true"
data-cipa-protect="true"
data-respect-gpc="true"
async>
</script>
shield.js is distributed via global Cloudflare edge caching (~3.2 KB brotli compressed). It executes synchronously in <1.4ms to install pre-DOM fetch and XHR intercepts without impacting Google Core Web Vitals (LCP/CLS).
Step 02: Configuration Attributes Reference
Configure behavioral switches directly on the script tag using data attributes:
| Attribute | Type | Default | Required | Purpose & Statutory Impact |
|---|---|---|---|---|
data-site-id | string | — | Yes | Your tenant identifier from the App Console. |
data-gcm-v2 | boolean | true | No | Automatically dispatches gtag('consent', 'update', ...) signals. |
data-cipa-protect | boolean | true | No | Blocks keystroke loggers & pixels before explicit consent. |
data-respect-gpc | boolean | true | No | Automatically honors Sec-GPC / navigator.globalPrivacyControl. |
data-theme | string | auto | No | Modal palette (dark, light, or auto). |
Step 03: Google Consent Mode v2 Verification
When data-gcm-v2="true" is enabled, Consent Shield initializes default denied states and updates signals upon user selection:
// Automatically executed by shield.js
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'wait_for_update': 500
});
// Real-time synchronization upon consent
window.addEventListener('consent_shield_update', (e) => {
console.log('Consent updated:', e.detail.categories);
});
Ready to verify your site?
Run a free multi-page scan across all trackers, cookies, and California wiretap vulnerabilities.