From 3d531924eb91cfc0c260431866e301a80f02a6fe Mon Sep 17 00:00:00 2001 From: amulero Date: Fri, 6 Nov 2026 12:36:58 +0100 Subject: [PATCH 1/2] Purge the ChatGPT Ads pixel's cookie and web storage on reject/withdraw 1.0.2 (#18) already deletes known tracking cookies (GA, Ads, Meta, Clarity, Brevo, sbjs_*) when the visitor rejects or withdraws consent. tuwebcumple.es still flagged "withdrawing consent really undoes it": the OpenAI ChatGPT Ads pixel left its __obref cookie and an oaiq_cs: sessionStorage entry. - Add __obref and oaiq_* to the purge list. - Apply the purge list to localStorage/sessionStorage keys as well. - Version 1.0.3-beta.withdraw. Co-Authored-By: Claude Opus 5.5 --- .../frontconsent-cookie-notice.js | 43 ++++++++++++++++++- .../frontconsent-cookie-notice.min.js | 2 +- frontconsent.php | 4 +- includes/Frontend/CookieNotice.php | 3 ++ readme.md | 2 +- readme.txt | 3 +- tests/js/cookie-notice-purge.test.js | 42 ++++++++++++++++-- 7 files changed, 90 insertions(+), 9 deletions(-) diff --git a/assets/cookie-notice/frontconsent-cookie-notice.js b/assets/cookie-notice/frontconsent-cookie-notice.js index 27fba1c..d5f66a7 100644 --- a/assets/cookie-notice/frontconsent-cookie-notice.js +++ b/assets/cookie-notice/frontconsent-cookie-notice.js @@ -69,7 +69,13 @@ function purgeTrackingCookies() { var patterns = Array.isArray(frcnCookieNotice.purgeCookies) ? frcnCookieNotice.purgeCookies : []; - if (!patterns.length || !document.cookie) { + if (!patterns.length) { + return; + } + + purgeTrackingStorage(patterns); + + if (!document.cookie) { return; } @@ -94,6 +100,41 @@ }); } + /** + * Same purge for localStorage/sessionStorage: some tags keep their + * identifiers there instead of (or as well as) in cookies — e.g. the + * OpenAI ChatGPT Ads pixel's `oaiq_cs:` session entry. + * Storage access can throw (blocked site data, private windows), so each + * store is handled on its own and failures are ignored. + * + * @param {string[]} patterns Purge patterns (see purgeTrackingCookies()). + */ + function purgeTrackingStorage(patterns) { + ['localStorage', 'sessionStorage'].forEach(function (storeName) { + try { + var store = window[storeName]; + + if (!store) { + return; + } + + var keys = []; + + for (var i = 0; i < store.length; i++) { + keys.push(store.key(i)); + } + + keys.forEach(function (key) { + if (key && matchesPurgePattern(key, patterns)) { + store.removeItem(key); + } + }); + } catch (e) { + // Storage unavailable: nothing to purge. + } + }); + } + function defineActivateGatedHelper() { window.frcnCookieNoticeActivateGated = window.frcnCookieNoticeActivateGated || function (allowedCategories) { if (allowedCategories && !allowedCategories.analytics) { diff --git a/assets/cookie-notice/frontconsent-cookie-notice.min.js b/assets/cookie-notice/frontconsent-cookie-notice.min.js index 2a75fa2..270edcf 100644 --- a/assets/cookie-notice/frontconsent-cookie-notice.min.js +++ b/assets/cookie-notice/frontconsent-cookie-notice.min.js @@ -1 +1 @@ -!function(){"use strict";function e(e){var o=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));if(!o)return"";try{return decodeURIComponent(o[1])}catch(e){return""}}function o(){var e=Array.isArray(frcnCookieNotice.purgeCookies)?frcnCookieNotice.purgeCookies:[];if(e.length&&document.cookie){for(var o=(window.location&&window.location.hostname?window.location.hostname:"").split("."),n=[""],t=0;t Array.from(cookies.jar.values()).map((cookie) => cookie.name), reopenListeners }; + return { actionListeners, cookieNames: () => Array.from(cookies.jar.values()).map((cookie) => cookie.name), reopenListeners, sessionStorage }; } test('rejecting deletes tracking cookies set on the host and on parent domains', () => { @@ -157,3 +170,26 @@ test('withdrawing an earlier acceptance deletes tracking cookies', () => { assert.deepEqual(environment.cookieNames(), []); }); + +test('withdrawing an earlier acceptance also deletes the ChatGPT Ads pixel cookie and storage entry', () => { + const environment = createEnvironment( + [ + ['frcn_cookie_consent', 'accepted', ''], + ['__obref', 'abc', ''] + ], + { 'oaiq_cs:PIXEL123': '1', unrelated: 'keep' } + ); + + environment.reopenListeners.click(); + + assert.deepEqual(environment.cookieNames(), []); + assert.deepEqual(environment.sessionStorage.keys(), ['unrelated']); +}); + +test('rejecting clears tracking entries kept in web storage', () => { + const environment = createEnvironment([], { 'oaiq_cs:PIXEL123': '1', unrelated: 'keep' }); + + environment.actionListeners.reject({ preventDefault() {} }); + + assert.deepEqual(environment.sessionStorage.keys(), ['unrelated']); +}); From 721be37786c0a995ab5e362fd619578e373842e8 Mon Sep 17 00:00:00 2001 From: amulero Date: Tue, 10 Nov 2026 16:38:04 +0100 Subject: [PATCH 2/2] Leave version and changelog to the release commit The version bump and changelog entry are done once on main when 1.0.3 is released, so the open PRs do not conflict with each other. Co-Authored-By: Claude Opus 5.5 --- frontconsent.php | 4 ++-- readme.txt | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frontconsent.php b/frontconsent.php index fe6cd2b..6780db7 100644 --- a/frontconsent.php +++ b/frontconsent.php @@ -3,7 +3,7 @@ * Plugin Name: FrontConsent * Plugin URI: https://wordpress.org/plugins/frontconsent/ * Description: GDPR/ePrivacy-compliant cookie consent banner for WordPress, following the AEPD guide. Configurable banner, Google Consent Mode v2, and tracking integrations that only load after consent. - * Version: 1.0.3-beta.withdraw + * Version: 1.0.2 * Author: CloseTechnology * Author URI: https://close.technology * Text Domain: frontconsent @@ -26,7 +26,7 @@ defined( 'ABSPATH' ) || die( 'No script kiddies please!' ); -define( 'FRCN_VERSION', '1.0.3-beta.withdraw' ); +define( 'FRCN_VERSION', '1.0.2' ); define( 'FRCN_PLUGIN', __FILE__ ); define( 'FRCN_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'FRCN_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); diff --git a/readme.txt b/readme.txt index 62afa77..677ee6f 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: cookies, consent, gdpr, cookie notice, aepd Requires at least: 5.8 Tested up to: 7.1 Stable tag: 1.0.2 -Version: 1.0.3-beta.withdraw +Version: 1.0.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -90,7 +90,6 @@ Service provided by OpenAI: [Terms of Use](https://openai.com/policies/terms-of- = Unreleased = * Added a Scanner tab that checks the site's cookie compliance through tuwebcumple.es and lists the result per requirement, plus a dashboard widget with the last grade. -* Rejecting or withdrawing consent now also deletes the OpenAI ChatGPT Ads pixel's `__obref` cookie, and the purge now clears matching entries from localStorage/sessionStorage too (e.g. the pixel's `oaiq_cs:*` entry). Same `frcn_cookie_notice_purge_cookies` list. = 1.0.2 = * Added an importer for GDPR Cookie Compliance settings in a new Integrations tab: migrates banner texts, layout, position, policy link and tracking IDs (GTM, GA4, GT-/AW-), enables the banner and reports any integration it couldn't map.