Fix TCF bridge widget click for Google Funding Choices (v1.3.1)
FC accepts the IAB __tcfapi('displayConsentUi', 2, …) command without
throwing but silently no-ops, which caused the previous order (IAB first,
FC-specific fallback second) to swallow the click. Reorder so that
googlefc.showRevocationMessage() is tried first whenever window.googlefc
is present, with the IAB call kept as the fallback for non-FC CMPs
(Sourcepoint, Didomi, etc).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: ATT Consent
|
* Plugin Name: ATT Consent
|
||||||
* Plugin URI: https://github.com/att-consent/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.
|
* 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 at least: 6.0
|
||||||
* Requires PHP: 7.4
|
* Requires PHP: 7.4
|
||||||
* Author: ATT Consent
|
* Author: ATT Consent
|
||||||
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
exit;
|
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_DIR', plugin_dir_path( __FILE__ ) );
|
||||||
define( 'ATT_CC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
define( 'ATT_CC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||||
define( 'ATT_CC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
define( 'ATT_CC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
||||||
|
|||||||
@@ -103,15 +103,12 @@
|
|||||||
widget.addEventListener('click', function (e) {
|
widget.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// 1. Standard IAB way (works for any compliant TCF v2.2 CMP).
|
// 1. Google Funding Choices: use its own re-prompt API.
|
||||||
if (typeof window.__tcfapi === 'function') {
|
// FC accepts but silently ignores the IAB 'displayConsentUi'
|
||||||
try {
|
// command, so we must try the FC path FIRST when FC is detected.
|
||||||
window.__tcfapi('displayConsentUi', 2, function () {});
|
if (window.googlefc && typeof window.googlefc.showRevocationMessage === 'function') {
|
||||||
return;
|
try { window.googlefc.showRevocationMessage(); return; } catch (err) {}
|
||||||
} catch (err) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Google Funding Choices specific re-prompt.
|
|
||||||
if (window.googlefc && window.googlefc.callbackQueue) {
|
if (window.googlefc && window.googlefc.callbackQueue) {
|
||||||
window.googlefc.callbackQueue.push({
|
window.googlefc.callbackQueue.push({
|
||||||
CONSENT_DATA_READY: function () {
|
CONSENT_DATA_READY: function () {
|
||||||
@@ -123,6 +120,12 @@
|
|||||||
return;
|
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
|
// 3. Last-ditch: scroll to a #privacy / #cookies anchor if the
|
||||||
// site has one in its footer. Fail silently otherwise.
|
// site has one in its footer. Fail silently otherwise.
|
||||||
var fallback = document.querySelector('a[href*="#cookie"], a[href*="#privacy"]');
|
var fallback = document.querySelector('a[href*="#cookie"], a[href*="#privacy"]');
|
||||||
|
|||||||
Reference in New Issue
Block a user