- Issue created by @dalberthab
- Status changed to Closed: won't fix
about 1 year ago 8:37am 15 January 2024 - 🇩🇪Germany Anybody Porta Westfalica
@dalberthab do I get you right, that you're suggesting a change to the server-side code?
If yes - that won't work due to caching. All logic needs to be client-side.I made the same request some years ago, until I understood, why it wouldn't be correct. Still you can check and react to consent in JS. That's the only correct way.
- 🇩🇪Germany Anybody Porta Westfalica
If you're reporting a bug in the JS code, please feel free to reopen and post a MR for a fix.
@Anybody I tried some hot code to test my suggested change (new to drupal)
function cookies_matomo_page_attachments(&$page) { $doKo = CookiesKnockOutService::getInstance()->doKnockOut(); if ($doKo && isset($page["#attached"]["html_head"])) {
to
function cookies_matomo_page_attachments(&$page) { $doKo = CookiesKnockOutService::getInstance()->doKnockOut(); $service = \Drupal::entityTypeManager()->getStorage('cookies_service')->load('matomo'); if ($doKo && $service->status() && $service->getConsentRequired() && isset($page["#attached"]["html_head"])) {
and the script type is not altered.