$items = []; foreach ($group['items'] as $item) { $newItem = ['name' => $item['name']]; if (!empty($item['presetId'])) { $newItem['identifier'] = $item['presetId']; } $items[] = $newItem; if ($group['isEssential']) { $counts['rcb_service_essential_count']++; } else { // Check if there is a visual content blocker connected to this service $visualContentBlocker = \array_filter($blocker, function ($blockerItem) use($item) { return \in_array($item['id'], $blockerItem['services'], \true); }); if ($item['legalBasis'] === ServiceTemplate::LEGAL_BASIS_CONSENT) { $counts['rcb_service_non-essential_legal-basis_consent_count']++; if (!empty($visualContentBlocker)) { $counts['rcb_service_non-essential_legal-basis_consent_with-visual-content-blocker_count']++; } } elseif ($item['legalBasis'] === ServiceTemplate::LEGAL_BASIS_LEGITIMATE_INTEREST) { $counts['rcb_service_non-essential_legal-basis_legitimate-interest_count']++; if (!empty($visualContentBlocker)) { $counts['rcb_service_non-essential_legal-basis_legitimate-interest_with-visual-content-blocker_count']++; } } } } return $items; }, $groups)))->add('rcb_contentBlockers', \array_map(function ($blocker) { $item = ['name' => $blocker['name']]; if (!empty($blocker['presetId'])) { $item['identifier'] = $blocker['presetId']; } return $item; }, $blocker))->add('rcb_scanner_externalUrls', \array_values(\array_map(function ($item) { return ['host' => $item['host'], 'tags' => $item['tags'], 'count' => $item['foundOnSitesCount']]; }, \DevOwl\RealCookieBanner\Core::getInstance()->getScanner()->getQuery()->getScannedExternalUrls()))); foreach ($counts as $key => $value) { $telemetry->add($key, $value); } // Stats $telemetry->add('rcb_consent_count', \DevOwl\RealCookieBanner\UserConsent::getInstance()->byCriteria([], \DevOwl\RealCookieBanner\UserConsent::BY_CRITERIA_RESULT_TYPE_COUNT)); if ($this->isPro()) { $statsTimeFrom = \gmdate('Y-m-d', \strtotime('-30 days')); $statsTimeTo = \gmdate('Y-m-d'); $clickedButton = $stats->fetchButtonsClickedStats($statsTimeFrom, $statsTimeTo); $customBypass = $stats->fetchCustomBypassStats($statsTimeFrom, $statsTimeTo); $clickedButtonResult = []; $customBypassResult = []; foreach ($clickedButton as $key => $value) { $clickedButtonResult[] = ['type' => $key, 'label' => $value[0], 'count' => $value[1]]; } foreach ($customBypass as $key => $value) { $customBypassResult[] = ['type' => $key, 'count' => $value]; } $telemetry->add('rcb_statistic_consentByClickedButton', $clickedButtonResult); $telemetry->add('rcb_statistic_consentByBypass', $customBypassResult); } $telemetry->add('rcb_customizer_consentOptions_acceptAll', $decision['acceptAll'])->add('rcb_customizer_consentOptions_acceptEssentials', $decision['acceptEssentials'])->add('rcb_customizer_consentOptions_acceptIndividual', $decision['acceptIndividual'])->add('rcb_settings_setCookiesViaManager', $generalSettings->getSetCookiesViaManager())->add('rcb_settings_acceptAllForBots', $consentSettings->isAcceptAllForBots())->add('rcb_settings_respectDoNotTrack', $consentSettings->isRespectDoNotTrack())->add('rcb_settings_ageNotice', $consentSettings->isAgeNoticeEnabled())->add('rcb_settings_listServicesNotice', $consentSettings->isListServicesNoticeEnabled())->add('rcb_settings_countryBypass', $countryBypassSettings->isActive())->add('rcb_settings_tcf', $tcfSettings->isActive())->add('rcb_settings_gcm', $gcmSettings->isEnabled())->add('rcb_settings_bannerLessConsent', $consentSettings->isBannerLessConsent())->add('rcb_settings_dataProcessingInUnsafeCountries', $consentSettings->isDataProcessingInUnsafeCountries())->add('rcb_settings_consentForwarding', $multisiteSettings->isConsentForwarding())->add('rcb_wpPlugins_active', $telemetry->getActivePlugins())->add('rcb_wpThemes_active', $telemetry->getActiveTheme()); } // Documented in AbstractInitiator public function formAdditionalCheckboxes() { if ($this->isPro() || \boolval(\get_option(FooterDesign::SETTING_POWERED_BY_LINK))) { return []; } return [['id' => 'powered-by-link', 'text' => \__('I allow to place a link in the cookie banner, which informs about the use of this plugin.', RCB_TD), 'stateFn' => function ($state) { if ($state) { \update_option(FooterDesign::SETTING_POWERED_BY_LINK, \true); } }]]; } }