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:
2026-07-09 07:57:11 +01:00
parent 68e7a6ac35
commit cde149467a
2 changed files with 5 additions and 3 deletions

View 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 +