From 64952510e5d653409c61315bc36b1b59e08b1cc0 Mon Sep 17 00:00:00 2001 From: Anton Afanasyeu Date: Mon, 6 Jul 2026 17:19:54 +0200 Subject: [PATCH] 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 --- assets/js/analytics.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/assets/js/analytics.js b/assets/js/analytics.js index be542e6..7b1c780 100644 --- a/assets/js/analytics.js +++ b/assets/js/analytics.js @@ -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); }