Cookie Consent Standalone Example

This example demonstrates the standalone cookie consent implementation.

Test Buttons

Manually control the cookie consent:

Gated Scripts

The following scripts will only load when consent is given:

Analytics (requires consent)

Marketing (requires consent)

Check your browser console to see when scripts are activated.

Usage Instructions

  1. Include cookie-consent-standalone.js in your <head>
  2. Initialize with CookieConsent.init() configuration
  3. Tag scripts with type="text/plain" data-category="analytics"
  4. Customize categories, position, theme as needed

Configuration Options

CookieConsent.init({
  cookieName: 'cc_cookie',      // Cookie storage name
  cookieExpiry: 365,             // Days until expiry
  autoShow: true,                // Show banner automatically
  position: 'bottom-right',      // Banner position
  theme: 'light',                // Theme: light or dark
  reloadOnChange: true,          // Reload page when preferences change
  categories: { ... }            // Your cookie categories
});

API Methods

Cookie preferences: