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:
parent
96f0139861
commit
5cc3d46997
1 changed files with 3 additions and 7 deletions
|
|
@ -116,7 +116,8 @@ export function setConsent(choice) {
|
||||||
v: VERSION,
|
v: VERSION,
|
||||||
ts: new Date().toISOString(),
|
ts: new Date().toISOString(),
|
||||||
necessary: true,
|
necessary: true,
|
||||||
analytics: !!choice.analytics,
|
// First-party measurement is always on (exempt); only marketing is a choice.
|
||||||
|
analytics: true,
|
||||||
marketing: !!choice.marketing,
|
marketing: !!choice.marketing,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
|
@ -125,12 +126,7 @@ export function setConsent(choice) {
|
||||||
|
|
||||||
listeners.forEach((fn) => { try { fn(getConsent()); } catch (_) { /* ignore */ } });
|
listeners.forEach((fn) => { try { fn(getConsent()); } catch (_) { /* ignore */ } });
|
||||||
|
|
||||||
if (next.analytics && !before.analytics) {
|
applyConsent();
|
||||||
applyConsent();
|
|
||||||
} else if (!next.analytics && before.analytics) {
|
|
||||||
try { window.op && window.op('clear'); } catch (_) { /* ignore */ }
|
|
||||||
try { window.location.reload(); } catch (_) { /* ignore */ }
|
|
||||||
}
|
|
||||||
return getConsent();
|
return getConsent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue