|
50 | 50 | $googleConsentModeScriptUrl = $addon->getAssetsUrl($googleConsentModeScriptFile); |
51 | 51 | $googleConsentModeOutput .= ' <script src="' . $googleConsentModeScriptUrl . '" defer></script>' . PHP_EOL; |
52 | 52 |
|
53 | | - // Debug-Script laden wenn Debug-Modus aktiviert |
| 53 | + // Debug-Script laden wenn Debug-Modus aktiviert UND User im Backend eingeloggt |
54 | 54 | if (isset($consent_manager->domainInfo['google_consent_mode_debug']) |
55 | 55 | && 1 === $consent_manager->domainInfo['google_consent_mode_debug']) { |
56 | | - $debugScriptUrl = $addon->getAssetsUrl('consent_debug.js'); |
57 | | - $googleConsentModeOutput .= ' <script src="' . $debugScriptUrl . '" defer></script>' . PHP_EOL; |
58 | | - |
59 | | - // Debug-Konfiguration für JavaScript verfügbar machen |
60 | | - $googleConsentModeOutput .= ' <script>' . PHP_EOL; |
61 | | - $googleConsentModeOutput .= ' window.consentManagerDebugConfig = ' . json_encode([ |
62 | | - 'mode' => $consent_manager->domainInfo['google_consent_mode_enabled'], |
63 | | - 'auto_mapping' => $consent_manager->domainInfo['google_consent_mode_enabled'] === 'auto', |
64 | | - 'debug_enabled' => true, |
65 | | - 'domain' => rex_request::server('HTTP_HOST'), |
66 | | - 'cache_log_id' => $consent_manager->cacheLogId, |
67 | | - 'version' => $consent_manager->version, |
68 | | - ]) . ';' . PHP_EOL; |
69 | | - $googleConsentModeOutput .= ' </script>' . PHP_EOL; |
| 56 | + // User für Frontend initialisieren |
| 57 | + rex_backend_login::createUser(); |
| 58 | + |
| 59 | + // Nur für eingeloggte Backend-Benutzer |
| 60 | + if (rex_backend_login::hasSession() && null !== rex::getUser()) { |
| 61 | + $debugScriptUrl = $addon->getAssetsUrl('consent_debug.js'); |
| 62 | + $googleConsentModeOutput .= ' <script src="' . $debugScriptUrl . '" defer></script>' . PHP_EOL; |
| 63 | + |
| 64 | + // Debug-Konfiguration für JavaScript verfügbar machen |
| 65 | + $googleConsentModeOutput .= ' <script>' . PHP_EOL; |
| 66 | + $googleConsentModeOutput .= ' window.consentManagerDebugConfig = ' . json_encode([ |
| 67 | + 'mode' => $consent_manager->domainInfo['google_consent_mode_enabled'], |
| 68 | + 'auto_mapping' => $consent_manager->domainInfo['google_consent_mode_enabled'] === 'auto', |
| 69 | + 'debug_enabled' => true, |
| 70 | + 'domain' => rex_request::server('HTTP_HOST'), |
| 71 | + 'cache_log_id' => $consent_manager->cacheLogId, |
| 72 | + 'version' => $consent_manager->version, |
| 73 | + ]) . ';' . PHP_EOL; |
| 74 | + $googleConsentModeOutput .= ' </script>' . PHP_EOL; |
| 75 | + } |
70 | 76 | } |
71 | 77 |
|
72 | 78 | // Auto-Mapping wird jetzt im Frontend-JS gehandhabt |
|
0 commit comments