1
0
mirror of git://f0xx.org/ac/ac-platform-web synced 2026-07-29 01:38:15 +03:00

fix(analytics): do not load GA4 until cookie consent is "all"

Previously gtag could load on first visit (no choice yet) or after partial
consent, pulling googletagmanager.com and triggering broken-HTTPS warnings
when that CDN hit cert errors on the client path.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-07-06 17:19:54 +02:00
parent a27f265dc4
commit 64952510e5

View File

@@ -19,10 +19,7 @@
function enabled() {
if (global.AndroidCastCookieConsent && !global.AndroidCastCookieConsent.allowsAnalytics()) {
var choice = global.AndroidCastCookieConsent.getChoice && global.AndroidCastCookieConsent.getChoice();
if (choice && choice !== 'all') {
return false;
}
return false;
}
return measurementId.length > 0 && /^G-[A-Z0-9]+$/i.test(measurementId);
}