fix(consent): la medición propia siempre activa; rechazar marketing ya no recarga la página

Claude-Session: https://claude.ai/code/session_01UNZxBnD6dnMGEdbvBVwoS7
This commit is contained in:
Victor Cavero 2026-09-07 20:04:14 +02:00
parent 96f0139861
commit 5cc3d46997

View file

@ -116,7 +116,8 @@ export function setConsent(choice) {
v: VERSION,
ts: new Date().toISOString(),
necessary: true,
analytics: !!choice.analytics,
// First-party measurement is always on (exempt); only marketing is a choice.
analytics: true,
marketing: !!choice.marketing,
};
try {
@ -125,12 +126,7 @@ export function setConsent(choice) {
listeners.forEach((fn) => { try { fn(getConsent()); } catch (_) { /* ignore */ } });
if (next.analytics && !before.analytics) {
applyConsent();
} else if (!next.analytics && before.analytics) {
try { window.op && window.op('clear'); } catch (_) { /* ignore */ }
try { window.location.reload(); } catch (_) { /* ignore */ }
}
return getConsent();
}