Skip to content

Roadmap Revisit Consent

Lauren Bridges edited this page Oct 19, 2025 · 1 revision

Roadmap: Revisit Consent (v1.2.0)

Goal: Implement a simple, non-intrusive method for users to clear their stored consent preference and re-trigger the banner's display. This fulfills the principle that users must have the right to change their mind.


1. The Architectural Challenge

The challenge is to force the front-end banner to reappear, even though its visibility is governed by a persistent value in the browser's localStorage. We must achieve this without introducing a complex, resource-heavy modal system.

2. The Solution: Simple JS Reset

We will use a delegated click handler in the existing quiet-consent.js file to detect a designated button or link added by the site owner, and then manipulate localStorage directly.

Step Action Code Implication Rationale
User Action Site owner adds <button class="qc-manage-consent"> to the footer. PHP/Theme adds a specific CSS class. Theme-agnostic trigger point.
JS Listener Plugin listens for a click on .qc-manage-consent. document.body.addEventListener('click', ...) Ensures the handler works on any dynamic element.
The Reset Clear the user's saved choice. localStorage.removeItem('quiet_consent'); Forces the banner logic to treat the user as a first-time visitor on the next page load.
Re-Display Immediately make the banner visible. banner.classList.add('qc-banner--is-visible'); Provides instant visual feedback to the user.

3. Implementation Snapshot (Code Added to quiet-consent.js)

document.body.addEventListener('click', function(e) {
    const target = e.target.closest('.qc-manage-consent');
    const banner = document.getElementById('quiet-consent-banner');
    
    if (target && banner) {
        e.preventDefault();
        
        // 1. Remove the stored preference
        localStorage.removeItem('quiet_consent');
        
        // 2. Stop running analytics (safety measure)
        window.gaInitialized = false; 
        
        // 3. Show the banner immediately
        banner.classList.add('qc-banner--is-visible');
        window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
    }
});