Use 3-day cookie expiry when analytics consent is denied (v1.3.2)
Denied consent was being stored with the full 365-day expiry, preventing the banner from re-appearing for users who initially declined. Now when analytics is denied the cookie expires in 3 days so those users are re-prompted automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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.1
|
||||
* Version: 1.3.2
|
||||
* 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.1' );
|
||||
define( 'ATT_CC_VERSION', '1.3.2' );
|
||||
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__ ) );
|
||||
|
||||
@@ -121,11 +121,13 @@ var AttConsent = (function() {
|
||||
|
||||
/**
|
||||
* Store consent choices in a first-party cookie.
|
||||
* If analytics is denied, use a short 3-day expiry so the banner re-appears
|
||||
* automatically rather than locking a denial in for a year.
|
||||
*
|
||||
* @param {Object} categories Consent categories.
|
||||
*/
|
||||
function setConsentCookie(categories) {
|
||||
var days = config.consent_expiry || 365;
|
||||
var days = categories.analytics ? (config.consent_expiry || 365) : 3;
|
||||
var expires = new Date(Date.now() + days * 864e5).toUTCString();
|
||||
var value = encodeURIComponent(JSON.stringify(categories));
|
||||
var cookie = 'att_cc_consent=' + value +
|
||||
|
||||
Reference in New Issue
Block a user