Skip to main content

Cookie / Consent Banner Plugin

The Cookie Consent plugin provides a configurable GDPR-friendly cookie consent banner for your LusterCMS website.

Overview

This plugin allows you to:

  • Display a consent banner on your public website
  • Customize banner text, colors, and position
  • Track visitor consent preferences
  • Conditionally load analytics based on consent

Installation

  1. Go to Plugins in your admin panel
  2. Find "Cookie / Consent Banner" in the marketplace
  3. Click Install
  4. Navigate to Plugins → Cookie Consent to configure

Configuration

Content Settings

SettingDescriptionDefault
TitleOptional banner title"Cookie Settings"
DescriptionMain consent messageStandard GDPR-friendly text
Accept All ButtonLabel for accepting all cookies"Accept all"
Necessary Only ButtonLabel for essential cookies only"Only necessary"
Learn More LinkLink text for privacy policy"Learn more"
Privacy URLPath to your privacy policy"/privacy"

Appearance Settings

SettingDescriptionDefault
PositionBanner position on screenBottom (full width)
Background ColorBanner background#1a1a2e (dark blue)
Text ColorBanner text color#ffffff (white)
Accent ColorButton and link color#7367F0 (purple)
Button StylePrimary, Secondary, or OutlinePrimary

Positions

  • Bottom - Full-width bar at the bottom of the screen
  • Bottom Left - Compact card in the bottom-left corner
  • Bottom Right - Compact card in the bottom-right corner
  • Full Width - Same as Bottom, spans entire width

The plugin stores the user's consent choice in localStorage:

// Key: luster_cookie_consent
// Values: "all" | "necessary"
localStorage.getItem("luster_cookie_consent");

Developer API

The plugin provides utility functions for checking consent:

hasFullConsent()

Returns true if the user has accepted all cookies.

import { hasFullConsent } from '@/plugins/cookie-consent/consent-utils';

if (hasFullConsent()) {
// Load Google Analytics, third-party widgets, etc.
initAnalytics();
}

getConsentLevel()

Returns the current consent level: "all", "necessary", or null (no decision yet).

import { getConsentLevel } from '@/plugins/cookie-consent/consent-utils';

const level = getConsentLevel();
if (level === "all") {
// Full consent given
} else if (level === "necessary") {
// Only essential cookies allowed
} else {
// No decision yet - show banner
}

hasConsentDecision()

Returns true if the user has made any consent decision.

import { hasConsentDecision } from '@/plugins/cookie-consent/consent-utils';

if (!hasConsentDecision()) {
// Show consent banner
}

Listen for consent changes:

window.addEventListener("luster-consent-change", (event) => {
const { level } = event.detail; // "all" or "necessary"
if (level === "all") {
loadAnalytics();
}
});

API Endpoints

Get Settings (Admin)

GET /api/plugins/cookie-consent/settings
Authorization: Bearer <token>

Update Settings (Admin)

PUT /api/plugins/cookie-consent/settings
Authorization: Bearer <token>
Content-Type: application/json

{
"enabled": true,
"descriptionText": "Custom message...",
"position": "bottom-right"
}

Get Public Settings (Frontend)

GET /api/plugins/cookie-consent/public

Returns settings for rendering the banner on the public website. No authentication required.

Integration with Themes

The banner component automatically appears on your public website when the plugin is enabled. To manually integrate:

import CookieConsentBanner from '@/plugins/cookie-consent/frontend/CookieConsentBanner';

function SiteLayout({ children }) {
const [config, setConfig] = useState(null);

useEffect(() => {
fetch('/api/plugins/cookie-consent/public')
.then(res => res.json())
.then(setConfig);
}, []);

return (
<>
{children}
<CookieConsentBanner config={config} />
</>
);
}

Best Practices

  1. Link to Privacy Policy - Always provide a link to your full privacy policy
  2. Clear Language - Use simple, understandable text
  3. Respect Choice - Actually disable non-essential cookies when user chooses "necessary only"
  4. Test on Mobile - Ensure the banner is usable on small screens

This plugin is a technical tool to help display consent banners. It does not constitute legal advice. You are responsible for:

  • Ensuring your cookie usage complies with applicable laws
  • Writing accurate consent text
  • Actually implementing consent-based cookie control
  • Consulting with legal counsel for compliance requirements