diff --git a/att-consent.php b/att-consent.php index 2078960..7484df1 100644 --- a/att-consent.php +++ b/att-consent.php @@ -3,7 +3,7 @@ * Plugin Name: ATT Consent * Plugin URI: https://github.com/att-consent/att-consent * Description: Google Consent Mode v2 cookie consent with session attribution preservation, custom script management, and full gtag.js/GTM support. - * Version: 1.3.0 + * Version: 1.3.1 * Requires at least: 6.0 * Requires PHP: 7.4 * Author: ATT Consent @@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -define( 'ATT_CC_VERSION', '1.3.0' ); +define( 'ATT_CC_VERSION', '1.3.1' ); define( 'ATT_CC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'ATT_CC_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'ATT_CC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); diff --git a/public/js/tcf-bridge.js b/public/js/tcf-bridge.js index f127d65..16aef3c 100644 --- a/public/js/tcf-bridge.js +++ b/public/js/tcf-bridge.js @@ -103,15 +103,12 @@ widget.addEventListener('click', function (e) { e.preventDefault(); - // 1. Standard IAB way (works for any compliant TCF v2.2 CMP). - if (typeof window.__tcfapi === 'function') { - try { - window.__tcfapi('displayConsentUi', 2, function () {}); - return; - } catch (err) {} + // 1. Google Funding Choices: use its own re-prompt API. + // FC accepts but silently ignores the IAB 'displayConsentUi' + // command, so we must try the FC path FIRST when FC is detected. + if (window.googlefc && typeof window.googlefc.showRevocationMessage === 'function') { + try { window.googlefc.showRevocationMessage(); return; } catch (err) {} } - - // 2. Google Funding Choices specific re-prompt. if (window.googlefc && window.googlefc.callbackQueue) { window.googlefc.callbackQueue.push({ CONSENT_DATA_READY: function () { @@ -123,6 +120,12 @@ return; } + // 2. Generic IAB TCF v2.2 re-prompt — for non-FC CMPs that + // actually implement this (Sourcepoint, Didomi, etc.). + if (typeof window.__tcfapi === 'function') { + try { window.__tcfapi('displayConsentUi', 2, function () {}); return; } catch (err) {} + } + // 3. Last-ditch: scroll to a #privacy / #cookies anchor if the // site has one in its footer. Fail silently otherwise. var fallback = document.querySelector('a[href*="#cookie"], a[href*="#privacy"]');