diff --git a/includes/components/pagetemplate.class.php b/includes/components/pagetemplate.class.php index c13d0eeb..ca81af86 100644 --- a/includes/components/pagetemplate.class.php +++ b/includes/components/pagetemplate.class.php @@ -467,13 +467,8 @@ class PageTemplate // refresh vars that shouldn't be cached private function update() : void { - // analytics + consent - // not set or declined - if (empty($_COOKIE['consent'])) - $this->hasAnalytics = false; - - // not set - if (!isset($_COOKIE['consent'])) + // not set, but should be + if (!isset($_COOKIE['consent']) && $this->hasAnalytics) { $this->addScript(SC_CSS_FILE, 'css/consent.css', SC_FLAG_NOCACHE); $this->addScript(SC_JS_FILE, 'js/consent.js', SC_FLAG_NOCACHE); @@ -481,6 +476,11 @@ class PageTemplate $this->consentFooter = true; } + // analytics + consent + // not set or declined + if (empty($_COOKIE['consent'])) + $this->hasAnalytics = false; + // js + css $this->prepareScripts();