diff --git a/plugins/Installation/tests/UI/expected-screenshots/Installation_js_tracking.png b/plugins/Installation/tests/UI/expected-screenshots/Installation_js_tracking.png index 1933223befb..07265ade7ce 100644 --- a/plugins/Installation/tests/UI/expected-screenshots/Installation_js_tracking.png +++ b/plugins/Installation/tests/UI/expected-screenshots/Installation_js_tracking.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:043fdac633ebf9573c7a1d39458fd9768273933a58b0be845905565f083af32c -size 313064 +oid sha256:1270447de6cedddfda2ebd967337602e3716d592205400cf93319fb2d785aaa7 +size 302476 diff --git a/plugins/SitesManager/Controller.php b/plugins/SitesManager/Controller.php index 5450851be1d..16501172e7e 100644 --- a/plugins/SitesManager/Controller.php +++ b/plugins/SitesManager/Controller.php @@ -369,9 +369,17 @@ private function getCmsInstruction() return ''; } - $detectedCms = $this->siteContentDetector->getSiteContentDetectionById(reset($detectedCMSes)); + $detectedCms = null; - if (null === $detectedCms) { + foreach ($detectedCMSes as $detected) { + $detectedCms = $this->siteContentDetector->getSiteContentDetectionById($detected); + + if (null !== $detectedCms && !empty($detectedCms::getInstructionUrl())) { + break; + } + } + + if (null === $detectedCms || empty($detectedCms::getInstructionUrl())) { return ''; } diff --git a/plugins/SitesManager/SiteContentDetection/Cloudflare.php b/plugins/SitesManager/SiteContentDetection/Cloudflare.php index d1f24df3398..4093ed117eb 100644 --- a/plugins/SitesManager/SiteContentDetection/Cloudflare.php +++ b/plugins/SitesManager/SiteContentDetection/Cloudflare.php @@ -10,12 +10,6 @@ namespace Piwik\Plugins\SitesManager\SiteContentDetection; -use Piwik\Piwik; -use Piwik\Request; -use Piwik\SiteContentDetector; -use Piwik\Url; -use Piwik\View; - class Cloudflare extends SiteContentDetectionAbstract { public static function getName(): string @@ -33,16 +27,6 @@ public static function getContentType(): int return self::TYPE_CMS; } - public static function getInstructionUrl(): ?string - { - return Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-my-cloudflare-setup/'); - } - - public static function getPriority(): int - { - return 40; - } - public function isDetected(?string $data = null, ?array $headers = null): bool { return ( @@ -54,31 +38,4 @@ public function isDetected(?string $data = null, ?array $headers = null): bool !empty($headers['CF-RAY']) ); } - - public function renderInstructionsTab(SiteContentDetector $detector): string - { - $view = new View("@SitesManager/_cloudflareTabInstructions"); - $view->idSite = Request::fromRequest()->getIntegerParameter('idSite'); - $view->wasDetected = $detector->wasDetected(self::getId()); - $view->sendHeadersWhenRendering = false; - return $view->render(); - } - - public function renderOthersInstruction(SiteContentDetector $detector): string - { - if ($detector->wasDetected(self::getId())) { - return ''; // don't show on others page if tab is being displayed - } - - return sprintf( - '

%s

', - Piwik::translate( - 'SitesManager_SiteWithoutDataCloudflareDescription', - [ - '', - '' - ] - ) - ); - } } diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index 1603867cc6e..11105c57c10 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -452,7 +452,6 @@ public function getClientSideTranslationKeys(&$translationKeys) $translationKeys[] = 'SitesManager_ShowTrackingTag'; $translationKeys[] = 'SitesManager_SiteSearchUse'; $translationKeys[] = 'SitesManager_SiteWithoutDataChooseTrackingMethod'; - $translationKeys[] = 'SitesManager_SiteWithoutDataCloudflareDescription'; $translationKeys[] = 'SitesManager_SiteWithoutDataGoogleTagManager'; $translationKeys[] = 'SitesManager_SiteWithoutDataGoogleTagManagerDescription'; $translationKeys[] = 'SitesManager_SiteWithoutDataHidePageForHour'; diff --git a/plugins/SitesManager/lang/en.json b/plugins/SitesManager/lang/en.json index eec4fbb232a..0abfc0a7404 100644 --- a/plugins/SitesManager/lang/en.json +++ b/plugins/SitesManager/lang/en.json @@ -82,20 +82,7 @@ "ShowTrackingTag": "View Tracking code", "Sites": "Websites", "SiteSearchUse": "You can use Matomo to track and report what visitors are searching in your website's internal search engine.", - "SiteWithoutDataCloudflareDescription": "You can use the Matomo App in Cloudflare to track data, follow the instructions from %1$sthis guide%2$s.", - "SiteWithoutDataCloudflareIntro": "If you use Cloudflare, you can start tracking data in Matomo seamlessly using the Matomo App available in Cloudflare.", "SiteWithoutDataCloudflareFollowStepsIntro": "Follow these steps to set it up:", - "SiteWithoutDataCloudflareFollowStep01": "%1$sLogin%2$s to your Cloudflare dashboard.", - "SiteWithoutDataCloudflareFollowStep02": "Click \"Websites\" on the left menu, and select the site on which you want to enable the Matomo tracking code.", - "SiteWithoutDataCloudflareFollowStep03": "Click \"Apps\" on the left menu.", - "SiteWithoutDataCloudflareFollowStep04": "Search for \"Matomo Analytics\" under the \"Search Apps\" input box.", - "SiteWithoutDataCloudflareFollowStep05": "Click on the \"Matomo Analytics\" app.", - "SiteWithoutDataCloudflareFollowStep06": "Click on \"Preview on your site\" button.", - "SiteWithoutDataCloudflareFollowStep07": "Configure the app by specifying the Matomo URL and Site ID for which you want to enable tracking.", - "SiteWithoutDataCloudflareFollowStep08": "Click \"Install on all pages\".", - "SiteWithoutDataCloudflareFollowStep09": "Review permissions and allow Cloudflare to share your email address with Matomo by clicking \"Continue\".", - "SiteWithoutDataCloudflareFollowStep10": "Wait for the app to install, and you will see the Matomo Analytics app installed under \"Your Installed Apps\" section.", - "SiteWithoutDataCloudflareFollowStepCompleted": "%1$sCongratulations!%2$s You have successfully installed the Matomo Analytics app on Cloudflare. To verify that hits are being tracked, visit your website and check that this data is visible in your Matomo instance.", "SiteWithoutDataOtherWays": "Other ways", "SiteWithoutDataOtherIntegrations": "Other integrations", "SiteWithoutDataGoogleTagManager": "Google Tag Manager", @@ -139,8 +126,6 @@ "GADetectedEmail": "%1$s was detected on your website. Did you know you can easily migrate your historical analytics data and settings from %2$s to Matomo? Learn more here: %3$s", "GTMDetected": "Google Tag Manager was detected on your website. Did you know you can migrate your existing tags, triggers and variables from Google Tag Manager to Matomo Tag Manager? %1$sLearn more in this guide%2$s.", "GTMDetectedEmail": "Google Tag Manager was detected on your website. Did you know you can migrate your existing tags, triggers and variables from Google Tag Manager to Matomo Tag Manager? Learn more here: %1$s", - "CloudflareDetected": "Cloudflare was detected on your website. Did you know you can use the Matomo app in your Cloudflare setup to track the website data? %1$sLearn more in this guide%2$s.", - "CloudflareDetectedEmail": "Cloudflare was detected on your website. Did you know you can use the Matomo app in your Cloudflare setup to track the website data? Learn more here: %1$s", "SiteWithoutDataGoogleTagManagerIntro": "If you use Google Tag Manager, you can start tracking data in Matomo seamlessly using the \"Custom HTML Tag\" available in Google Tag Manager. %1$sLearn more%2$s.", "SiteWithoutDataGoogleTagManagerFollowStepsIntro": "Follow these steps to set it up:", "SiteWithoutDataGTMFollowStep1": "%1$sLogin%2$s into your Google Tag Manager account.", diff --git a/plugins/SitesManager/templates/_cloudflareTabInstructions.twig b/plugins/SitesManager/templates/_cloudflareTabInstructions.twig deleted file mode 100644 index 3a6226dee0b..00000000000 --- a/plugins/SitesManager/templates/_cloudflareTabInstructions.twig +++ /dev/null @@ -1,25 +0,0 @@ -

{{ 'SitesManager_StepByStepGuide'|translate }}

- -{% if wasDetected %} -
- {{ 'SitesManager_CloudflareDetected'|translate(externallink('https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-my-cloudflare-setup/'),'')|raw }} -
-{% endif %} - -

{{ 'SitesManager_SiteWithoutDataCloudflareIntro'|translate }}

-
-

{{ 'SitesManager_SiteWithoutDataCloudflareFollowStepsIntro'|translate }}

-
    -
  1. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep01'|translate('','')|raw }}
  2. -
  3. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep02'|translate }}
  4. -
  5. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep03'|translate }}
  6. -
  7. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep04'|translate }}
  8. -
  9. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep05'|translate }}
  10. -
  11. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep06'|translate }}
  12. -
  13. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep07'|translate }}
    Matomo URL: {{ piwikUrl }}
    {{ 'SitesManager_EmailInstructionsYourSiteId'|translate('' ~ idSite ~ '')|raw }}
  14. -
  15. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep08'|translate }}
  16. -
  17. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep09'|translate }}
  18. -
  19. {{ 'SitesManager_SiteWithoutDataCloudflareFollowStep10'|translate }}
  20. -
-
-

{{ 'SitesManager_SiteWithoutDataCloudflareFollowStepCompleted'|translate('','')|raw }}

diff --git a/plugins/SitesManager/templates/_displayJavascriptCode.twig b/plugins/SitesManager/templates/_displayJavascriptCode.twig index b4b45b548c2..26bc4193777 100644 --- a/plugins/SitesManager/templates/_displayJavascriptCode.twig +++ b/plugins/SitesManager/templates/_displayJavascriptCode.twig @@ -48,9 +48,6 @@

WordPress

{{ 'SitesManager_SiteWithoutDataWordpressDescription'|translate(externallink('https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-wordpress/'),'')|raw }}

-

Cloudflare

-

{{ 'SitesManager_SiteWithoutDataCloudflareDescription'|translate(externallink('https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-my-cloudflare-setup/'),'')|raw }}

-

Vue.js

{{ 'SitesManager_SiteWithoutDataVueDescription'|translate(externallink('https://github.com/AmazingDreams/vue-matomo') ~ 'vue-matomo', externallink('https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-websites-that-use-vue-js/'),'')|raw }}

diff --git a/plugins/SitesManager/templates/_trackingCodeEmail.twig b/plugins/SitesManager/templates/_trackingCodeEmail.twig index d0c1310f36c..22090ed77df 100644 --- a/plugins/SitesManager/templates/_trackingCodeEmail.twig +++ b/plugins/SitesManager/templates/_trackingCodeEmail.twig @@ -13,10 +13,6 @@ {% if 'GoogleTagManager' in trackers %} {{ 'SitesManager_GTMDetectedEmail'|translate(externalrawlink('https://matomo.org/faq/tag-manager/migrating-from-google-tag-manager/'))|raw }} -{% endif %} -{% if 'Cloudflare' in cms %} -{{ 'SitesManager_CloudflareDetectedEmail'|translate(externalrawlink('https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-my-cloudflare-setup/'))|raw }} - {% endif %} {% if 'VueJs' in jsFrameworks %} diff --git a/tests/UI/expected-screenshots/EmptySite_cloudflare.png b/tests/UI/expected-screenshots/EmptySite_cloudflare.png deleted file mode 100644 index 4fb6c31e2ce..00000000000 --- a/tests/UI/expected-screenshots/EmptySite_cloudflare.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bd7b16a3e738b8d7f3897e777e3b70c5601061bd07dfd36f8d9bfdcbfadbe03c -size 130072 diff --git a/tests/UI/expected-screenshots/EmptySite_detected_cloudflare.png b/tests/UI/expected-screenshots/EmptySite_detected_cloudflare.png deleted file mode 100644 index cd9e1bb1efc..00000000000 --- a/tests/UI/expected-screenshots/EmptySite_detected_cloudflare.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:36fac73eaec752455c02e24cdfc2a2629cc53892d679bbb326f1633a7d24cb97 -size 104641 diff --git a/tests/UI/expected-screenshots/EmptySite_detected_wordpress.png b/tests/UI/expected-screenshots/EmptySite_detected_wordpress.png index 632917df3c1..73977009d36 100644 --- a/tests/UI/expected-screenshots/EmptySite_detected_wordpress.png +++ b/tests/UI/expected-screenshots/EmptySite_detected_wordpress.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:acda1941f8eca78bd204ef9ea24ec63fdba83a449bf11fd73a3c6881788be597 -size 27432 +oid sha256:14a5e417575150feef14fe57aca9599e37cd5da99c67691f625ee6afec653388 +size 103900 diff --git a/tests/UI/expected-screenshots/EmptySite_emptySiteDashboard.png b/tests/UI/expected-screenshots/EmptySite_emptySiteDashboard.png index 6f9e3bbb96d..8c2cc090322 100644 --- a/tests/UI/expected-screenshots/EmptySite_emptySiteDashboard.png +++ b/tests/UI/expected-screenshots/EmptySite_emptySiteDashboard.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b76f77e67d4d7e675eac37d16d88b30a10b0344bf0fc889199cec11eb2ed40a4 -size 102046 +oid sha256:e028f33300163b0bafb8db4f2f8189356e6d6e3d4d6730b653f4fab60f845431 +size 100042 diff --git a/tests/UI/expected-screenshots/EmptySite_integrations.png b/tests/UI/expected-screenshots/EmptySite_integrations.png new file mode 100644 index 00000000000..c09da2700ec --- /dev/null +++ b/tests/UI/expected-screenshots/EmptySite_integrations.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:766db394fb37566083caaa693a614e4f74c52426b6a4c8aef064df3560294c4e +size 95359 diff --git a/tests/UI/expected-screenshots/EmptySite_other.png b/tests/UI/expected-screenshots/EmptySite_other.png index e51c735d1c9..f10f31c5c47 100644 --- a/tests/UI/expected-screenshots/EmptySite_other.png +++ b/tests/UI/expected-screenshots/EmptySite_other.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:27ef2aa929157ad4ad253a51ff8e2d15b05c3cb85fda628c19dff5ba55e43e83 -size 215390 +oid sha256:ad6d018adda624022166b1fb008bd07c897a46a8145d9903566b22bae4d12435 +size 202339 diff --git a/tests/UI/specs/EmptySite_spec.js b/tests/UI/specs/EmptySite_spec.js index 6fb342ad5bb..9b37f6ba9b5 100644 --- a/tests/UI/specs/EmptySite_spec.js +++ b/tests/UI/specs/EmptySite_spec.js @@ -131,17 +131,17 @@ describe("EmptySite", function () { testEnvironment.connectedConsentManagers = []; testEnvironment.save(); - await page.goto(urlToTest + "#?" + generalParams + "&activeTab=cloudflare"); + await page.goto(urlToTest + "#?" + generalParams + "&activeTab=integrations"); await page.waitForSelector('#start-tracking-details'); // wait till details ar shown await makeTrackingCodeStatic(); const pageElement = await page.$('.page'); - expect(await pageElement.screenshot()).to.matchImage('cloudflare'); + expect(await pageElement.screenshot()).to.matchImage('integrations'); }); // take one full screenshot when a detected method is shown - it('should suggest cloudflare method when detected, other detections should be shown first', async function () { - testEnvironment.detectedContentDetections = ['Cloudflare', 'VueJs']; + it('should suggest wordpress method when detected, other detections should be shown first', async function () { + testEnvironment.detectedContentDetections = ['WordPress', 'VueJs']; testEnvironment.connectedConsentManagers = []; testEnvironment.save(); @@ -150,12 +150,12 @@ describe("EmptySite", function () { await page.waitForSelector('#start-tracking-method-list'); // wait till list is shown const pageElement = await page.$('.page'); - expect(await pageElement.screenshot()).to.matchImage('detected_cloudflare'); + expect(await pageElement.screenshot()).to.matchImage('detected_wordpress'); }); // only take shots from recommended method for other detections it('should prefer gtm method over others when detected', async function () { - testEnvironment.detectedContentDetections = ['GoogleTagManager', 'WordPress', 'Cloudflare']; + testEnvironment.detectedContentDetections = ['GoogleTagManager', 'WordPress', 'VueJs']; testEnvironment.connectedConsentManagers = []; testEnvironment.save(); @@ -167,20 +167,6 @@ describe("EmptySite", function () { expect(await pageElement.screenshot()).to.matchImage('detected_gtm'); }); - it('should prefer wordpress method over cloudflare when detected', async function () { - testEnvironment.detectedContentDetections = ['WordPress', 'Cloudflare']; - testEnvironment.connectedConsentManagers = []; - testEnvironment.save(); - - await page.goto('about:blank'); - await page.goto(urlToTest); - await page.waitForSelector('#start-tracking-method-list'); // wait till list is shown - - const pageElement = await page.$('#start-tracking-detection'); - expect(await pageElement.screenshot()).to.matchImage('detected_wordpress'); - }); - - it('should should show a notification on the tracking code screen when a consent manager is detected', async function () { testEnvironment.detectedContentDetections = ['Osano']; testEnvironment.connectedConsentManagers = ['Osano'];