|
54 | 54 | $googleConsentModeScriptFile = 'google_consent_mode_v2.js'; |
55 | 55 | } |
56 | 56 | $googleConsentModeScriptUrl = $addon->getAssetsUrl($googleConsentModeScriptFile); |
57 | | - $googleConsentModeOutput .= ' <script src="' . $googleConsentModeScriptUrl . '" defer></script>' . PHP_EOL; |
| 57 | + $googleConsentModeOutput .= ' <script nonce="' . rex_response::getNonce() . '" src="' . $googleConsentModeScriptUrl . '" defer></script>' . PHP_EOL; |
58 | 58 |
|
59 | 59 | // Debug-Script laden wenn Debug-Modus aktiviert UND User im Backend eingeloggt |
60 | 60 | if (isset($consent_manager->domainInfo['google_consent_mode_debug']) |
|
65 | 65 | // Nur für eingeloggte Backend-Benutzer |
66 | 66 | if (rex_backend_login::hasSession() && null !== rex::getUser()) { |
67 | 67 | $debugScriptUrl = $addon->getAssetsUrl('consent_debug.js'); |
68 | | - $googleConsentModeOutput .= ' <script src="' . $debugScriptUrl . '" defer></script>' . PHP_EOL; |
| 68 | + $googleConsentModeOutput .= ' <script nonce="' . rex_response::getNonce() . '" src="' . $debugScriptUrl . '" defer></script>' . PHP_EOL; |
69 | 69 |
|
70 | 70 | // Debug-Konfiguration für JavaScript verfügbar machen |
71 | | - $googleConsentModeOutput .= ' <script>' . PHP_EOL; |
| 71 | + $googleConsentModeOutput .= ' <script nonce="' . rex_response::getNonce() . '">' . PHP_EOL; |
72 | 72 | $googleConsentModeOutput .= ' window.consentManagerDebugConfig = ' . json_encode([ |
73 | 73 | 'mode' => $consent_manager->domainInfo['google_consent_mode_enabled'], |
74 | 74 | 'auto_mapping' => 'auto' === $consent_manager->domainInfo['google_consent_mode_enabled'], |
|
164 | 164 | 'mode' => 'opt-in', |
165 | 165 | ]; |
166 | 166 |
|
167 | | -$consentparams['outputjs'] .= ' <script>var consent_manager_parameters = ' . json_encode($jsConfig, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ';</script>' . PHP_EOL; |
168 | | -$consentparams['outputjs'] .= ' <script src="' . rex_url::frontendController($_params) . '" id="consent_manager_script" defer></script>' . PHP_EOL; |
| 167 | +$consentparams['outputjs'] .= ' <script nonce="' . rex_response::getNonce() . '">var consent_manager_parameters = ' . json_encode($jsConfig, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ';</script>' . PHP_EOL; |
| 168 | +$consentparams['outputjs'] .= ' <script nonce="' . rex_response::getNonce() . '" src="' . rex_url::frontendController($_params) . '" id="consent_manager_script" defer></script>' . PHP_EOL; |
169 | 169 |
|
170 | 170 | // Ausgabe Google Consent Mode v2 (vor allem anderen) |
171 | 171 | echo $googleConsentModeOutput; |
|
0 commit comments