Consent Banner
Cookie consent banner shown to first-time visitors. Gates Google Analytics and Facebook Pixel until the visitor accepts.
Where it shows
Bottom of every storefront page, for visitors who haven't made a decision yet. After they accept or decline, the banner doesn't show again (stored in localStorage).
User choices
- Accept All — enables analytics + marketing tracking (GA + FB Pixel fire)
- Decline — no tracking; only strictly necessary cookies (session, auth)
The banner is intentionally simple. No multi-tab consent manager — just yes or no.
Under the hood
- State managed by
ConsentContext(React context) - Stored in localStorage key
spectra_consent - Values:
null(undecided),accepted,declined - Analytics scripts are rendered only when
consent === 'accepted' - Consent decision is tied to the browser, not the user account
What's gated
If the visitor declines:
- Google Analytics script never loads
- Facebook Pixel script never loads
- No third-party cookies set
consent_analyticsflag saved on orders (for audit)
If they accept:
- GA loads using
google_analytics_idfrom tenant config - FB Pixel loads using
facebook_pixel_idfrom tenant config - Standard pageview + ecommerce events fire
Re-consent
Users can change their decision:
- Storefront footer → "Cookie Preferences" link (opens a modal to re-choose)
- Clearing browser storage also clears the decision (banner re-shows)
Admin configuration
Enable/disable per tenant:
- Set
google_analytics_idto enable GA tracking - Set
facebook_pixel_idto enable FB Pixel - No dedicated toggle — if the IDs are blank, nothing loads even on accept
Jurisdictions
This banner is designed for EU/UK GDPR + California CCPA compliance:
- Explicit opt-in (not pre-checked)
- Clear accept / decline choice
- No tracking until consent
- Easy to withdraw consent later
For even stricter jurisdictions (some EU states require per-cookie consent), you may need a full consent manager — planned for a future phase.