From 927de0c4e8a38892248fb304fa7a1283b6cf4b50 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Mon, 18 May 2026 04:28:32 -0700 Subject: [PATCH 1/8] styling more of updated welcome page --- classes/WpMatomo/Admin/views/marketplace.php | 788 +++++++++++-------- 1 file changed, 465 insertions(+), 323 deletions(-) diff --git a/classes/WpMatomo/Admin/views/marketplace.php b/classes/WpMatomo/Admin/views/marketplace.php index 4d273d9e8..c677317bf 100644 --- a/classes/WpMatomo/Admin/views/marketplace.php +++ b/classes/WpMatomo/Admin/views/marketplace.php @@ -22,373 +22,515 @@ /** @var string $matomo_currency */ ?> -
- -
- - + + + - show(); - return; +is_network_enabled() && ! is_network_admin() && is_super_admin() ) { ?> +
+

+
+ + +show(); + return; +} +?> + + +
+

+ +

+ + + +

+ +
+
+
+ Matomo Logo +

+ +

+
+

+ +

+
+

+ ', + '' + ); ?> +

+
+
+ ... +
+
+
+
+
+ 1 + +
+

+ +

+
+ +
+
+
+
+ 2 + +
+

+ +

+
+ +
+
+
+
+ +' . esc_html( $matomo_feature_section['title'] ) . ''; + echo '
'; + + foreach ( $matomo_feature_section['features'] as $matomo_index => $matomo_feature ) { + $matomo_style = ''; + $matomo_is_3_columns = 3 === $matomo_num_features_in_block; + if ( $matomo_is_3_columns ) { + $matomo_style = 'width: calc(33% - 8px);min-width:282px;max-width:350px;'; + if ( 2 === $matomo_index % 3 ) { + $matomo_style .= 'clear: inherit;margin-right: 0;margin-left: 16px;'; } - $plugin_url = empty( $matomo_feature['url'] ) ? null : $matomo_feature['url'] . '&matomoversion=' . $matomo_version; - ?> -
- - - +
+ + + -
-
+
-

- - - - - - +

+ + + + -

-
-
" + rel="noreferrer noopener" target="_blank" + class="thickbox open-plugin-details-modal"> + + +
+
- " - style="margin-right: 0; - - "> + if ( ! empty( $matomo_feature['price'] ) && 'free' !== $matomo_feature['price'] ) { + ?> + - - +

+ ' . esc_html__( 'Learn more', 'matomo' ) . ''; + } elseif ( ! empty( $matomo_feature['url'] ) ) { + echo ' ' . esc_html__( 'Learn more', 'matomo' ) . ''; } ?> -

+

+ +

+ ' . esc_html__( 'Learn more', 'matomo' ) . ''; - } elseif ( ! empty( $matomo_feature['url'] ) ) { - echo ' ' . esc_html__( 'Learn more', 'matomo' ) . ''; + if ( 'free' === $matomo_feature['price'] ) { + esc_html_e( 'Download', 'matomo' ); + } else { + ?> + + style="vertical-align: middle;" + + > + +

-

- - - - style="vertical-align: middle;" - - > - - -

- -
+ } + ?>
-
'; - if ( ! empty( $matomo_feature_section['more_url'] ) ) { - echo '' . esc_html( $matomo_feature_section['more_text'] ) . ''; - } - echo '
'; + // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped + echo $matomo_extra_card_html; + ?> +
+
'; + if ( ! empty( $matomo_feature_section['more_url'] ) ) { + echo '' . esc_html( $matomo_feature_section['more_text'] ) . ''; } + echo '
'; } +} - $matomo_feature_sections = [ - [ - 'title' => 'What\'s New', - 'class' => 'matomo-new-plugins', - 'extra_card_html' => '' . esc_html__( 'New!', 'matomo' ) . '', - 'features' => +$matomo_feature_sections = [ + [ + 'title' => 'What\'s New', + 'class' => 'matomo-new-plugins', + 'extra_card_html' => '' . esc_html__( 'New!', 'matomo' ) . '', + 'features' => + [ + [ + 'name' => 'Crash Analytics', + 'description' => 'Detect crashes to improve the user experience, increase conversions and recover revenue. Resolve them with insights to minimise developer hours.', + 'price' => '79EUR / 89USD', + 'url' => 'https://plugins.matomo.org/CrashAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', + ], + ], + ], + [ + 'title' => 'Top free plugins', + 'more_url' => 'https://plugins.matomo.org/free?wp=1&pk_campaign=WP&pk_source=Plugin', + 'more_text' => 'Browse all free plugins', + 'features' => + [ [ - [ - 'name' => 'Crash Analytics', - 'description' => 'Detect crashes to improve the user experience, increase conversions and recover revenue. Resolve them with insights to minimise developer hours.', - 'price' => '79EUR / 89USD', - 'url' => 'https://plugins.matomo.org/CrashAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], + 'name' => 'Marketing Campaigns Reporting', + 'description' => 'Measure the effectiveness of your marketing campaigns. Track up to five channels instead of two: campaign, source, medium, keyword, content.', + 'price' => 'free', + 'download_url' => 'https://plugins.matomo.org/api/2.0/plugins/MarketingCampaignsReporting/download/latest?wp=1' . $matomo_extra_url_params, + 'url' => 'https://plugins.matomo.org/MarketingCampaignsReporting?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', ], - ], - [ - 'title' => 'Top free plugins', - 'more_url' => 'https://plugins.matomo.org/free?wp=1&pk_campaign=WP&pk_source=Plugin', - 'more_text' => 'Browse all free plugins', - 'features' => [ - [ - 'name' => 'Marketing Campaigns Reporting', - 'description' => 'Measure the effectiveness of your marketing campaigns. Track up to five channels instead of two: campaign, source, medium, keyword, content.', - 'price' => 'free', - 'download_url' => 'https://plugins.matomo.org/api/2.0/plugins/MarketingCampaignsReporting/download/latest?wp=1' . $matomo_extra_url_params, - 'url' => 'https://plugins.matomo.org/MarketingCampaignsReporting?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Custom Alerts', - 'description' => 'Create custom Alerts to be notified of important changes on your website or app!', - 'price' => 'free', - 'download_url' => 'https://plugins.matomo.org/api/2.0/plugins/CustomAlerts/download/latest?wp=1' . $matomo_extra_url_params, - 'url' => 'https://plugins.matomo.org/CustomAlerts?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], + 'name' => 'Custom Alerts', + 'description' => 'Create custom Alerts to be notified of important changes on your website or app!', + 'price' => 'free', + 'download_url' => 'https://plugins.matomo.org/api/2.0/plugins/CustomAlerts/download/latest?wp=1' . $matomo_extra_url_params, + 'url' => 'https://plugins.matomo.org/CustomAlerts?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', ], - ], - ]; + ], + ], +]; - /** @var \WpMatomo\Settings $settings */ - $matomo_version = $settings->get_matomo_major_version(); +/** @var \WpMatomo\Settings $settings */ +$matomo_version = $settings->get_matomo_major_version(); - matomo_show_tables( $matomo_feature_sections, $matomo_version, $matomo_currency ); +matomo_show_tables( $matomo_feature_sections, $matomo_version, $matomo_currency ); - echo '
'; +echo '
'; - $matomo_feature_sections = [ - [ - 'title' => 'Most popular premium features', - 'features' => +$matomo_feature_sections = [ + [ + 'title' => 'Most popular premium features', + 'features' => + [ [ - [ - 'name' => 'Heatmap & Session Recording', - 'description' => 'Truly understand your visitors by seeing where they click, hover, type and scroll. Replay their actions in a video and ultimately increase conversions.', - 'price' => '109EUR / 129USD', - 'url' => 'https://plugins.matomo.org/HeatmapSessionRecording?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Custom Reports', - 'description' => 'Pull out the information you need in order to be successful. Develop your custom strategy to meet your individualized goals while saving money & time.', - 'price' => '109EUR / 129USD', - 'url' => 'https://plugins.matomo.org/CustomReports?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - - [ - 'name' => 'Premium Bundle', - 'description' => 'All premium features in one bundle, make the most out of your Matomo for WordPress and enjoy discounts of over 25%!', - 'price' => '549EUR / 639USD', - 'url' => 'https://plugins.matomo.org/WpPremiumBundle?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], + 'name' => 'Heatmap & Session Recording', + 'description' => 'Truly understand your visitors by seeing where they click, hover, type and scroll. Replay their actions in a video and ultimately increase conversions.', + 'price' => '109EUR / 129USD', + 'url' => 'https://plugins.matomo.org/HeatmapSessionRecording?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', ], - ], - [ - 'title' => 'Most popular content engagement', - 'features' => [ - [ - 'name' => 'Form Analytics', - 'description' => 'Increase conversions on your online forms and lose less visitors by learning everything about your users behavior and their pain points on your forms.', - 'price' => '89EUR / 99USD', - 'url' => 'https://plugins.matomo.org/FormAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Video & Audio Analytics', - 'description' => 'Grow your business with advanced video & audio analytics. Get powerful insights into how your audience watches your videos and listens to your audio.', - 'price' => '89EUR / 99USD', - 'url' => 'https://plugins.matomo.org/MediaAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Users Flow', - 'description' => 'Users Flow is a visual representation of the most popular paths your users take through your website & app which lets you understand your users needs.', - 'price' => '49EUR / 59USD', - 'url' => 'https://plugins.matomo.org/UsersFlow?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], + 'name' => 'Custom Reports', + 'description' => 'Pull out the information you need in order to be successful. Develop your custom strategy to meet your individualized goals while saving money & time.', + 'price' => '109EUR / 129USD', + 'url' => 'https://plugins.matomo.org/CustomReports?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', ], - ], - [ - 'title' => 'Most popular acquisition & SEO features', - 'features' => + [ - [ - 'name' => 'Search Engine Keywords Performance', - 'description' => 'All keywords searched by your users on search engines are now visible into your Referrers reports! The ultimate solution to \'Keyword not defined\'.', - 'price' => '79EUR / 89USD', - 'url' => 'https://plugins.matomo.org/SearchEngineKeywordsPerformance?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'SEO Web Vitals', - 'description' => 'Improve your website performance, rank higher in search results and optimise your visitor experience with SEO Web Vitals.', - 'price' => '49EUR / 59USD', - 'url' => 'https://plugins.matomo.org/SEOWebVitals?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], + 'name' => 'Premium Bundle', + 'description' => 'All premium features in one bundle, make the most out of your Matomo for WordPress and enjoy discounts of over 25%!', + 'price' => '549EUR / 639USD', + 'url' => 'https://plugins.matomo.org/WpPremiumBundle?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', ], - ], - [ - 'title' => '', - 'features' => + ], + ], + [ + 'title' => 'Most popular content engagement', + 'features' => + [ [ - [ - 'name' => 'Advertising Conversion Export', - 'description' => 'Provides an export of attributed goal conversions for usage in ad networks like Google Ads so you no longer need a conversion pixel.', - 'price' => '89EUR / 99USD', - 'url' => 'https://plugins.matomo.org/AdvertisingConversionExport?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Multi Attribution', - 'description' => 'Get a clear understanding of how much credit each of your marketing channel is actually responsible for to shift your marketing efforts wisely.', - 'price' => '49EUR / 59USD', - 'url' => 'https://plugins.matomo.org/MultiChannelConversionAttribution?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], + 'name' => 'Form Analytics', + 'description' => 'Increase conversions on your online forms and lose less visitors by learning everything about your users behavior and their pain points on your forms.', + 'price' => '89EUR / 99USD', + 'url' => 'https://plugins.matomo.org/FormAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', ], - ], - [ - 'title' => 'Other premium features', - 'features' => [ - [ - 'name' => 'Funnels', - 'description' => 'Identify and understand where your visitors drop off to increase your conversions, sales and revenue with your existing traffic.', - 'price' => '99EUR / 119USD', - 'url' => 'https://plugins.matomo.org/Funnels?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Cohorts', - 'description' => 'Track your retention efforts over time and keep your visitors engaged and coming back for more.', - 'price' => '49EUR / 59USD', - 'url' => 'https://plugins.matomo.org/Cohorts?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Crash Analytics', - 'description' => 'Detect crashes to improve the user experience, increase conversions and recover revenue. Resolve them with insights to minimise developer hours.', - 'price' => '79EUR / 89USD', - 'url' => 'https://plugins.matomo.org/CrashAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], + 'name' => 'Video & Audio Analytics', + 'description' => 'Grow your business with advanced video & audio analytics. Get powerful insights into how your audience watches your videos and listens to your audio.', + 'price' => '89EUR / 99USD', + 'url' => 'https://plugins.matomo.org/MediaAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', ], - ], - ]; - - matomo_show_tables( $matomo_feature_sections, $matomo_version, $matomo_currency ); + [ + 'name' => 'Users Flow', + 'description' => 'Users Flow is a visual representation of the most popular paths your users take through your website & app which lets you understand your users needs.', + 'price' => '49EUR / 59USD', + 'url' => 'https://plugins.matomo.org/UsersFlow?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', + ], + ], + ], + [ + 'title' => 'Most popular acquisition & SEO features', + 'features' => + [ + [ + 'name' => 'Search Engine Keywords Performance', + 'description' => 'All keywords searched by your users on search engines are now visible into your Referrers reports! The ultimate solution to \'Keyword not defined\'.', + 'price' => '79EUR / 89USD', + 'url' => 'https://plugins.matomo.org/SearchEngineKeywordsPerformance?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', + ], + [ + 'name' => 'SEO Web Vitals', + 'description' => 'Improve your website performance, rank higher in search results and optimise your visitor experience with SEO Web Vitals.', + 'price' => '49EUR / 59USD', + 'url' => 'https://plugins.matomo.org/SEOWebVitals?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', + ], + ], + ], + [ + 'title' => '', + 'features' => + [ + [ + 'name' => 'Advertising Conversion Export', + 'description' => 'Provides an export of attributed goal conversions for usage in ad networks like Google Ads so you no longer need a conversion pixel.', + 'price' => '89EUR / 99USD', + 'url' => 'https://plugins.matomo.org/AdvertisingConversionExport?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', + ], + [ + 'name' => 'Multi Attribution', + 'description' => 'Get a clear understanding of how much credit each of your marketing channel is actually responsible for to shift your marketing efforts wisely.', + 'price' => '49EUR / 59USD', + 'url' => 'https://plugins.matomo.org/MultiChannelConversionAttribution?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', + ], + ], + ], + [ + 'title' => 'Other premium features', + 'features' => + [ + [ + 'name' => 'Funnels', + 'description' => 'Identify and understand where your visitors drop off to increase your conversions, sales and revenue with your existing traffic.', + 'price' => '99EUR / 119USD', + 'url' => 'https://plugins.matomo.org/Funnels?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', + ], + [ + 'name' => 'Cohorts', + 'description' => 'Track your retention efforts over time and keep your visitors engaged and coming back for more.', + 'price' => '49EUR / 59USD', + 'url' => 'https://plugins.matomo.org/Cohorts?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', + ], + [ + 'name' => 'Crash Analytics', + 'description' => 'Detect crashes to improve the user experience, increase conversions and recover revenue. Resolve them with insights to minimise developer hours.', + 'price' => '79EUR / 89USD', + 'url' => 'https://plugins.matomo.org/CrashAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', + 'image' => '', + ], + ], + ], +]; - ?> +matomo_show_tables( $matomo_feature_sections, $matomo_version, $matomo_currency ); -
+?> From e1454decedbd66954ed0c843d741849d4e44a995 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Wed, 20 May 2026 00:35:58 -0700 Subject: [PATCH 2/8] start adding most popular features content to welcome page --- assets/css/admin-style.css | 2 +- classes/WpMatomo/Admin/views/marketplace.php | 40 +++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/assets/css/admin-style.css b/assets/css/admin-style.css index c91ffa02c..107604a08 100644 --- a/assets/css/admin-style.css +++ b/assets/css/admin-style.css @@ -22,7 +22,7 @@ ol.matomo-list { .matomo-plugin-list .plugin-card-top { min-height: auto; -} + .matomo-plugin-list .plugin-card-top .matomo-description { min-height: 80px; diff --git a/classes/WpMatomo/Admin/views/marketplace.php b/classes/WpMatomo/Admin/views/marketplace.php index c677317bf..38be55486 100644 --- a/classes/WpMatomo/Admin/views/marketplace.php +++ b/classes/WpMatomo/Admin/views/marketplace.php @@ -123,6 +123,12 @@ class="nav-tab svg { + width: 16px; + height: 16px; + margin-right: 4px; + } + /** TODO: responsiveness */

-

+

@@ -172,6 +194,8 @@ class="nav-tab

+ + ...
@@ -201,6 +225,20 @@ class="nav-tab
+ +

+

+ + Date: Thu, 21 May 2026 01:58:07 -0700 Subject: [PATCH 3/8] fill out welcome page and make buttons functional --- assets/css/admin-style.css | 10 +- assets/js/marketplace_setup_wizard.js | 28 +- classes/WpMatomo/Admin/Marketplace.php | 1 + .../WpMatomo/Admin/MarketplaceSetupWizard.php | 12 +- .../Admin/MarketplaceSetupWizardBody.php | 4 +- classes/WpMatomo/Admin/views/marketplace.php | 520 ++++++------------ 6 files changed, 198 insertions(+), 377 deletions(-) diff --git a/assets/css/admin-style.css b/assets/css/admin-style.css index 527a420dd..8ad84590a 100644 --- a/assets/css/admin-style.css +++ b/assets/css/admin-style.css @@ -22,7 +22,7 @@ ol.matomo-list { .matomo-plugin-list .plugin-card-top { min-height: auto; - +} .matomo-plugin-list .plugin-card-top .matomo-description { min-height: 80px; @@ -317,6 +317,10 @@ table.matomo-tracking-form th { color: #2271b1; } +.matomo-primary-color-fill { + fill: #2271b1; +} + .matomo-secondary-color-fg { color: #f6f7f7; } @@ -333,6 +337,10 @@ table.matomo-tracking-form th { color: var(--wp-admin-theme-color, #3858e9); } +.mtm-wp-gte-7 .matomo-primary-color-fill { + fill: var(--wp-admin-theme-color, #3858e9); +} + .mtm-wp-gte-7 .matomo-secondary-color-fg { color: white; } diff --git a/assets/js/marketplace_setup_wizard.js b/assets/js/marketplace_setup_wizard.js index 5a4d6d075..6eaf78943 100644 --- a/assets/js/marketplace_setup_wizard.js +++ b/assets/js/marketplace_setup_wizard.js @@ -7,8 +7,12 @@ */ window.jQuery(document).ready(function ($) { - function pollForPluginActivation() { - $('.wizard-waiting-for').show(); + function pollForPluginActivation(setActiveClass) { + if (setActiveClass) { + $('.wizard-waiting-for').addClass('active').find('.waiting-for-install').show(); + } else { + $('.wizard-waiting-for').show(); + } var interval = setInterval(function () { $.post(mtmMarketplaceWizardAjax.ajax_url, { @@ -16,11 +20,16 @@ window.jQuery(document).ready(function ($) { action: 'matomo_is_marketplace_active', }, function (data) { if (data.active) { - $('.wizard-waiting-for').hide(); - $('.wizard-reloading').show(); + if (!setActiveClass) { + $('.wizard-waiting-for').hide(); + $('.wizard-reloading').show(); + } window.location.reload(); clearInterval(interval); + } else if (data.installed && setActiveClass) { + $('.wizard-waiting-for .waiting-for-install').hide(); + $('.wizard-waiting-for .waiting-for-activation').show(); } }); }, 2000); @@ -39,7 +48,14 @@ window.jQuery(document).ready(function ($) { } if (typeof mtmMarketplaceWizardAjax !== 'undefined' && mtmMarketplaceWizardAjax.ajax_url) { - $('.matomo-marketplace-wizard-body .open-plugin-upload').on('click', pollForPluginActivation); - $('.matomo-marketplace-wizard-body .activate-plugin').on('click', activateMarketplace); + var pollFn = pollForPluginActivation; + var activateFn = activateMarketplace; + if (mtmMarketplaceWizardAjax.is_welcome_page) { + pollFn = pollForPluginActivation.bind(null, true); + activateFn = activateMarketplace.bind(null, true); + } + + $('.matomo-marketplace-wizard-body .open-plugin-upload').on('click', pollFn); + $('.matomo-marketplace-wizard-body .activate-plugin').on('click', activateFn); } }); diff --git a/classes/WpMatomo/Admin/Marketplace.php b/classes/WpMatomo/Admin/Marketplace.php index 01d42297d..be90ab9e3 100644 --- a/classes/WpMatomo/Admin/Marketplace.php +++ b/classes/WpMatomo/Admin/Marketplace.php @@ -53,6 +53,7 @@ public function show() { $valid_tabs = $this->get_valid_tabs(); $marketplace_setup_wizard = \WpMatomo::get_active_feature( MarketplaceSetupWizard::class ); + $matomo_marketplace_url = MarketplaceSetupWizardBody::get_marketplace_zip_url(); } $matomo_currency = $this->get_currency_based_on_timezone(); diff --git a/classes/WpMatomo/Admin/MarketplaceSetupWizard.php b/classes/WpMatomo/Admin/MarketplaceSetupWizard.php index 283b0edb0..6ea6350d2 100644 --- a/classes/WpMatomo/Admin/MarketplaceSetupWizard.php +++ b/classes/WpMatomo/Admin/MarketplaceSetupWizard.php @@ -34,9 +34,7 @@ public function is_active() { return false; } - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $tab = isset( $_REQUEST['tab'] ) ? wp_unslash( $_REQUEST['tab'] ) : ''; - return 'install' === $tab || 'subscriptions' === $tab; + return true; // displayed in some manner on all tabs } public function get_body( $show_titles = true ) { @@ -70,6 +68,7 @@ public function enqueue_scripts() { 'ajax_url' => admin_url( 'admin-ajax.php' ), 'is_active_nonce' => wp_create_nonce( self::AJAX_IS_ACTIVE_NONCE_NAME ), 'activate_nonce' => wp_create_nonce( self::AJAX_ACTIVATE_NONCE_NAME ), + 'is_welcome_page' => wp_unslash( $_REQUEST['page'] ) === Menu::SLUG_MARKETPLACE && wp_unslash( $_REQUEST['tab'] ) === 'marketplace', ] ); } @@ -86,7 +85,12 @@ public static function is_marketplace_active() { wp_send_json_error( [ 'message' => 'forbidden' ], 403 ); } - wp_send_json( [ 'active' => is_plugin_active( self::MARKETPLACE_PLUGIN_FILE ) ] ); + wp_send_json( + [ + 'installed' => self::is_marketplace_installed(), + 'active' => is_plugin_active( self::MARKETPLACE_PLUGIN_FILE ), + ] + ); } public static function activate_marketplace_plugin() { diff --git a/classes/WpMatomo/Admin/MarketplaceSetupWizardBody.php b/classes/WpMatomo/Admin/MarketplaceSetupWizardBody.php index 5c68b18d8..cc6d2a46f 100644 --- a/classes/WpMatomo/Admin/MarketplaceSetupWizardBody.php +++ b/classes/WpMatomo/Admin/MarketplaceSetupWizardBody.php @@ -26,12 +26,12 @@ public function show() { $is_plugin_installed = MarketplaceSetupWizard::is_marketplace_installed(); $matomo_show_title = $this->matomo_show_title; $matomo_is_plugin_active = is_plugin_active( MarketplaceSetupWizard::MARKETPLACE_PLUGIN_FILE ); - $matomo_marketplace_url = $this->get_marketplace_zip_url(); + $matomo_marketplace_url = self::get_marketplace_zip_url(); include dirname( __FILE__ ) . '/views/marketplace_setup_wizard_body.php'; } - private function get_marketplace_zip_url() { + public static function get_marketplace_zip_url() { if ( defined( 'MATOMO_MARKETPLACE_ZIP_URL' ) && MATOMO_MARKETPLACE_ZIP_URL ) { return MATOMO_MARKETPLACE_ZIP_URL; } diff --git a/classes/WpMatomo/Admin/views/marketplace.php b/classes/WpMatomo/Admin/views/marketplace.php index 38be55486..564f44a8d 100644 --- a/classes/WpMatomo/Admin/views/marketplace.php +++ b/classes/WpMatomo/Admin/views/marketplace.php @@ -21,13 +21,14 @@ ); /** @var string $matomo_currency */ +/** @var string $matomo_marketplace_url */ ?> '; - echo '
'; - - foreach ( $matomo_feature_section['features'] as $matomo_index => $matomo_feature ) { - $matomo_style = ''; - $matomo_is_3_columns = 3 === $matomo_num_features_in_block; - if ( $matomo_is_3_columns ) { - $matomo_style = 'width: calc(33% - 8px);min-width:282px;max-width:350px;'; - if ( 2 === $matomo_index % 3 ) { - $matomo_style .= 'clear: inherit;margin-right: 0;margin-left: 16px;'; - } - } - $plugin_url = empty( $matomo_feature['url'] ) ? null : $matomo_feature['url'] . '&matomoversion=' . $matomo_version; - ?> -
- - - - -
-
-

- - - - - - -

-
-
- - - -

- ' . esc_html__( 'Learn more', 'matomo' ) . ''; - } elseif ( ! empty( $matomo_feature['url'] ) ) { - echo ' ' . esc_html__( 'Learn more', 'matomo' ) . ''; - } - ?> -

- -

- - - - style="vertical-align: middle;" - - > - - -

- -
-
- -
-
'; - if ( ! empty( $matomo_feature_section['more_url'] ) ) { - echo '' . esc_html( $matomo_feature_section['more_text'] ) . ''; - } - echo '
'; - } -} - -$matomo_feature_sections = [ - [ - 'title' => 'What\'s New', - 'class' => 'matomo-new-plugins', - 'extra_card_html' => '' . esc_html__( 'New!', 'matomo' ) . '', - 'features' => - [ - [ - 'name' => 'Crash Analytics', - 'description' => 'Detect crashes to improve the user experience, increase conversions and recover revenue. Resolve them with insights to minimise developer hours.', - 'price' => '79EUR / 89USD', - 'url' => 'https://plugins.matomo.org/CrashAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - ], - ], - [ - 'title' => 'Top free plugins', - 'more_url' => 'https://plugins.matomo.org/free?wp=1&pk_campaign=WP&pk_source=Plugin', - 'more_text' => 'Browse all free plugins', - 'features' => - [ - [ - 'name' => 'Marketing Campaigns Reporting', - 'description' => 'Measure the effectiveness of your marketing campaigns. Track up to five channels instead of two: campaign, source, medium, keyword, content.', - 'price' => 'free', - 'download_url' => 'https://plugins.matomo.org/api/2.0/plugins/MarketingCampaignsReporting/download/latest?wp=1' . $matomo_extra_url_params, - 'url' => 'https://plugins.matomo.org/MarketingCampaignsReporting?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Custom Alerts', - 'description' => 'Create custom Alerts to be notified of important changes on your website or app!', - 'price' => 'free', - 'download_url' => 'https://plugins.matomo.org/api/2.0/plugins/CustomAlerts/download/latest?wp=1' . $matomo_extra_url_params, - 'url' => 'https://plugins.matomo.org/CustomAlerts?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - ], - ], -]; - -/** @var \WpMatomo\Settings $settings */ -$matomo_version = $settings->get_matomo_major_version(); - -matomo_show_tables( $matomo_feature_sections, $matomo_version, $matomo_currency ); - -echo '
'; - -$matomo_feature_sections = [ - [ - 'title' => 'Most popular premium features', - 'features' => - [ - [ - 'name' => 'Heatmap & Session Recording', - 'description' => 'Truly understand your visitors by seeing where they click, hover, type and scroll. Replay their actions in a video and ultimately increase conversions.', - 'price' => '109EUR / 129USD', - 'url' => 'https://plugins.matomo.org/HeatmapSessionRecording?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Custom Reports', - 'description' => 'Pull out the information you need in order to be successful. Develop your custom strategy to meet your individualized goals while saving money & time.', - 'price' => '109EUR / 129USD', - 'url' => 'https://plugins.matomo.org/CustomReports?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - - [ - 'name' => 'Premium Bundle', - 'description' => 'All premium features in one bundle, make the most out of your Matomo for WordPress and enjoy discounts of over 25%!', - 'price' => '549EUR / 639USD', - 'url' => 'https://plugins.matomo.org/WpPremiumBundle?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - ], - ], - [ - 'title' => 'Most popular content engagement', - 'features' => - [ - [ - 'name' => 'Form Analytics', - 'description' => 'Increase conversions on your online forms and lose less visitors by learning everything about your users behavior and their pain points on your forms.', - 'price' => '89EUR / 99USD', - 'url' => 'https://plugins.matomo.org/FormAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Video & Audio Analytics', - 'description' => 'Grow your business with advanced video & audio analytics. Get powerful insights into how your audience watches your videos and listens to your audio.', - 'price' => '89EUR / 99USD', - 'url' => 'https://plugins.matomo.org/MediaAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Users Flow', - 'description' => 'Users Flow is a visual representation of the most popular paths your users take through your website & app which lets you understand your users needs.', - 'price' => '49EUR / 59USD', - 'url' => 'https://plugins.matomo.org/UsersFlow?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - ], - ], - [ - 'title' => 'Most popular acquisition & SEO features', - 'features' => - [ - [ - 'name' => 'Search Engine Keywords Performance', - 'description' => 'All keywords searched by your users on search engines are now visible into your Referrers reports! The ultimate solution to \'Keyword not defined\'.', - 'price' => '79EUR / 89USD', - 'url' => 'https://plugins.matomo.org/SearchEngineKeywordsPerformance?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'SEO Web Vitals', - 'description' => 'Improve your website performance, rank higher in search results and optimise your visitor experience with SEO Web Vitals.', - 'price' => '49EUR / 59USD', - 'url' => 'https://plugins.matomo.org/SEOWebVitals?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - ], - ], - [ - 'title' => '', - 'features' => - [ - [ - 'name' => 'Advertising Conversion Export', - 'description' => 'Provides an export of attributed goal conversions for usage in ad networks like Google Ads so you no longer need a conversion pixel.', - 'price' => '89EUR / 99USD', - 'url' => 'https://plugins.matomo.org/AdvertisingConversionExport?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Multi Attribution', - 'description' => 'Get a clear understanding of how much credit each of your marketing channel is actually responsible for to shift your marketing efforts wisely.', - 'price' => '49EUR / 59USD', - 'url' => 'https://plugins.matomo.org/MultiChannelConversionAttribution?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - ], - ], - [ - 'title' => 'Other premium features', - 'features' => - [ - [ - 'name' => 'Funnels', - 'description' => 'Identify and understand where your visitors drop off to increase your conversions, sales and revenue with your existing traffic.', - 'price' => '99EUR / 119USD', - 'url' => 'https://plugins.matomo.org/Funnels?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Cohorts', - 'description' => 'Track your retention efforts over time and keep your visitors engaged and coming back for more.', - 'price' => '49EUR / 59USD', - 'url' => 'https://plugins.matomo.org/Cohorts?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - [ - 'name' => 'Crash Analytics', - 'description' => 'Detect crashes to improve the user experience, increase conversions and recover revenue. Resolve them with insights to minimise developer hours.', - 'price' => '79EUR / 89USD', - 'url' => 'https://plugins.matomo.org/CrashAnalytics?wp=1&pk_campaign=WP&pk_source=Plugin', - 'image' => '', - ], - ], - ], -]; - -matomo_show_tables( $matomo_feature_sections, $matomo_version, $matomo_currency ); - -?> From 5e8fece04206e9c89357b0380c788a496247bacc Mon Sep 17 00:00:00 2001 From: diosmosis Date: Thu, 21 May 2026 02:25:48 -0700 Subject: [PATCH 4/8] show notice on plugin upload page if query param is present --- .../WpMatomo/Admin/MarketplaceSetupWizard.php | 39 +++++++++++++++++++ classes/WpMatomo/Admin/views/marketplace.php | 2 +- .../views/marketplace_setup_wizard_body.php | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/classes/WpMatomo/Admin/MarketplaceSetupWizard.php b/classes/WpMatomo/Admin/MarketplaceSetupWizard.php index 6ea6350d2..369e8585b 100644 --- a/classes/WpMatomo/Admin/MarketplaceSetupWizard.php +++ b/classes/WpMatomo/Admin/MarketplaceSetupWizard.php @@ -22,6 +22,10 @@ public function is_active() { return false; } + if ( $this->is_plugin_install_page() ) { + return true; + } + if ( empty( $_REQUEST['page'] ) ) { return false; } @@ -50,6 +54,20 @@ public function show() { public function register_hooks() { add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); + add_action( 'admin_notices', [ $this, 'admin_notices' ] ); + } + + public function admin_notices() { + if ( ! $this->is_plugin_install_page() ) { + return; + } + ?> +
+

+ +

+
+

- +
diff --git a/classes/WpMatomo/Admin/views/marketplace_setup_wizard_body.php b/classes/WpMatomo/Admin/views/marketplace_setup_wizard_body.php index dfe827b1c..22d1d1c67 100644 --- a/classes/WpMatomo/Admin/views/marketplace_setup_wizard_body.php +++ b/classes/WpMatomo/Admin/views/marketplace_setup_wizard_body.php @@ -46,7 +46,7 @@ From 69a642ac3997ec36e9bec8a9b9557ace6d0f7bb6 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Thu, 21 May 2026 06:16:55 -0700 Subject: [PATCH 5/8] complete functionality of new welcome page --- assets/js/marketplace_setup_wizard.js | 11 ++- classes/WpMatomo/Admin/Marketplace.php | 13 ++- .../WpMatomo/Admin/MarketplaceSetupWizard.php | 88 +++++++++++++++++-- classes/WpMatomo/Admin/views/marketplace.php | 53 ++++++----- marketplace | 2 +- 5 files changed, 129 insertions(+), 38 deletions(-) diff --git a/assets/js/marketplace_setup_wizard.js b/assets/js/marketplace_setup_wizard.js index 6eaf78943..0eed5cf62 100644 --- a/assets/js/marketplace_setup_wizard.js +++ b/assets/js/marketplace_setup_wizard.js @@ -22,10 +22,17 @@ window.jQuery(document).ready(function ($) { if (data.active) { if (!setActiveClass) { $('.wizard-waiting-for').hide(); - $('.wizard-reloading').show(); + } else { + $('.wizard-waiting-for .waiting-for-activation').hide(); } - window.location.reload(); + $('.wizard-reloading').show(); + + // reload after the dom has had a chance to update + setTimeout(function () { + window.location.reload(); + }); + clearInterval(interval); } else if (data.installed && setActiveClass) { $('.wizard-waiting-for .waiting-for-install').hide(); diff --git a/classes/WpMatomo/Admin/Marketplace.php b/classes/WpMatomo/Admin/Marketplace.php index be90ab9e3..53b33d53a 100644 --- a/classes/WpMatomo/Admin/Marketplace.php +++ b/classes/WpMatomo/Admin/Marketplace.php @@ -53,7 +53,9 @@ public function show() { $valid_tabs = $this->get_valid_tabs(); $marketplace_setup_wizard = \WpMatomo::get_active_feature( MarketplaceSetupWizard::class ); - $matomo_marketplace_url = MarketplaceSetupWizardBody::get_marketplace_zip_url(); + $matomo_marketplace_url = MarketplaceSetupWizardBody::get_marketplace_zip_url(); + } else { + wp_safe_redirect( admin_url( 'admin.php?page=matomo-marketplace&tab=install' ) ); } $matomo_currency = $this->get_currency_based_on_timezone(); @@ -62,7 +64,14 @@ public function show() { } private function get_valid_tabs() { - $valid_tabs = [ 'marketplace' ]; + $valid_tabs = []; + if ( + ! MarketplaceSetupWizard::is_marketplace_installed() + || ! is_plugin_active( MarketplaceSetupWizard::MARKETPLACE_PLUGIN_FILE ) + ) { + $valid_tabs[] = 'marketplace'; + } + if ( $this->can_user_manage() ) { if ( current_user_can( 'install_plugins' ) ) { $valid_tabs[] = 'install'; diff --git a/classes/WpMatomo/Admin/MarketplaceSetupWizard.php b/classes/WpMatomo/Admin/MarketplaceSetupWizard.php index 369e8585b..cb0e5fc59 100644 --- a/classes/WpMatomo/Admin/MarketplaceSetupWizard.php +++ b/classes/WpMatomo/Admin/MarketplaceSetupWizard.php @@ -22,7 +22,10 @@ public function is_active() { return false; } - if ( $this->is_plugin_install_page() ) { + if ( + $this->is_plugin_install_page() + || $this->is_plugin_activation_request() + ) { return true; } @@ -55,6 +58,35 @@ public function show() { public function register_hooks() { add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); add_action( 'admin_notices', [ $this, 'admin_notices' ] ); + add_action( 'activated_plugin', [ $this, 'on_plugin_activated' ] ); + add_action( 'admin_footer', [ $this, 'on_admin_footer' ] ); + } + + public function on_plugin_activated( $plugin ) { + if ( 'matomo-marketplace-for-wordpress/matomo-marketplace-for-wordpress.php' !== $plugin ) { + return; + } + + if ( + empty( $_SERVER['HTTP_REFERER'] ) + || false === strpos( esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ), 'mtm_marketplace_install' ) + ) { + return; + } + + // if we are in the marketplace install workflow, and the plugin has been + // activated, close the current window to go back to the marketplace setup + ?> + + + + + + +

- +

is_plugin_install_page() ) { + return; + } + + // add script to add query param to plugin upload form submit URL + ?> + + admin_url( 'admin-ajax.php' ), 'is_active_nonce' => wp_create_nonce( self::AJAX_IS_ACTIVE_NONCE_NAME ), 'activate_nonce' => wp_create_nonce( self::AJAX_ACTIVATE_NONCE_NAME ), - 'is_welcome_page' => wp_unslash( $_REQUEST['page'] ) === Menu::SLUG_MARKETPLACE && wp_unslash( $_REQUEST['tab'] ) === 'marketplace', + 'is_welcome_page' => isset( $_REQUEST['page'] ) + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + && Menu::SLUG_MARKETPLACE === wp_unslash( $_REQUEST['page'] ) + && isset( $_REQUEST['tab'] ) + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + && 'marketplace' === wp_unslash( $_REQUEST['tab'] ), ] ); } @@ -132,14 +185,15 @@ private function is_plugin_install_page() { return false; } - $request_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); + $request_path = wp_parse_url( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), PHP_URL_PATH ); if ( ! preg_match( '%/wp-admin/plugin-install\\.php$%', $request_path ) ) { return false; } if ( empty( $_REQUEST['tab'] ) - || wp_unslash( $_REQUEST['tab'] ) !== 'upload' + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + || 'upload' !== wp_unslash( $_REQUEST['tab'] ) || empty( $_REQUEST['mtm_marketplace_install'] ) ) { return false; @@ -147,4 +201,28 @@ private function is_plugin_install_page() { return true; } + + private function is_plugin_activation_request() { + if ( empty( $_SERVER['REQUEST_URI'] ) ) { + return false; + } + + $request_path = wp_parse_url( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ), PHP_URL_PATH ); + if ( ! preg_match( '%/wp-admin/plugins\\.php$%', $request_path ) ) { + return false; + } + + if ( + empty( $_REQUEST['action'] ) + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + || 'activate' !== wp_unslash( $_REQUEST['action'] ) + || empty( $_REQUEST['plugin'] ) + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + || 'matomo-marketplace-for-wordpress/matomo-marketplace-for-wordpress.php' !== wp_unslash( $_REQUEST['plugin'] ) + ) { + return false; + } + + return true; + } } diff --git a/classes/WpMatomo/Admin/views/marketplace.php b/classes/WpMatomo/Admin/views/marketplace.php index 7120552bc..43955d17b 100644 --- a/classes/WpMatomo/Admin/views/marketplace.php +++ b/classes/WpMatomo/Admin/views/marketplace.php @@ -33,7 +33,7 @@ class="nav-tab + >

- ', '' - ); ?> + ); + ?>

+ + +
@@ -284,7 +281,7 @@ class="nav-tab

- +
@@ -310,7 +307,7 @@ class="nav-tab [ + 'MarketingCampaignsReporting' => [ 'name' => __( 'Marketing Campaigns Reporting', 'matomo' ), 'desc' => __( "Measure the effectiveness of your marketing campaigns. Track up to five channels instead of two: campaign, source, medium, keyword, content.', 'matomo'", 'matomo' ), ], @@ -319,31 +316,31 @@ class="nav-tab __( 'All keywords searched by your users on search engines are now visible into your Referrers reports! The ultimate solution to \'Keyword not defined\'.', 'matomo' ), 'price' => '79EUR / 89USD', ], - 'HeatmapSessionRecording' => [ + 'HeatmapSessionRecording' => [ 'name' => __( 'Heatmap & Session Recording', 'matomo' ), 'desc' => __( 'Truly understand your visitors by seeing where they click, hover, type and scroll. Replay their actions in a video and ultimately increase conversions.', 'matomo' ), 'price' => '109EUR / 129USD', ], - 'CustomAlerts' => [ - 'name' => __( 'Custom Alerts', 'matomo' ), - 'desc' => __( 'Create custom Alerts to be notified of important changes on your website or app!', 'matomo' ), + 'CustomAlerts' => [ + 'name' => __( 'Custom Alerts', 'matomo' ), + 'desc' => __( 'Create custom Alerts to be notified of important changes on your website or app!', 'matomo' ), ], - 'MediaAnalytics' => [ + 'MediaAnalytics' => [ 'name' => __( 'Media Analytics', 'matomo' ), 'desc' => __( 'Grow your business with advanced video & audio analytics. Get powerful insights into how your audience watches your videos and listens to your audio.', 'matomo' ), 'price' => '89EUR / 99USD', ], - 'CustomReports' => [ + 'CustomReports' => [ 'name' => __( 'Custom Reports', 'matomo' ), 'desc' => __( 'Pull out the information you need in order to be successful. Develop your custom strategy to meet your individualized goals while saving money & time.', 'matomo' ), 'price' => '109EUR / 129USD', ], - 'WpPremiumBundle' => [ + 'WpPremiumBundle' => [ 'name' => __( 'WordPress Premium Bundle', 'matomo' ), 'desc' => __( 'All premium features in one bundle, make the most out of your Matomo for WordPress and enjoy discounts of up to 25%!', 'matomo' ), 'price' => '549EUR / 639USD', ], - 'UsersFlow' => [ + 'UsersFlow' => [ 'name' => __( 'Users Flow', 'matomo' ), 'desc' => __( 'Users Flow is a visual representation of the most popular paths your users take through your website & app which lets you understand your users needs.', 'matomo' ), 'price' => '49EUR / 59USD', diff --git a/marketplace b/marketplace index 5789985a5..d058e2330 160000 --- a/marketplace +++ b/marketplace @@ -1 +1 @@ -Subproject commit 5789985a5f07af092e46f78fc9f17936c26fe7b9 +Subproject commit d058e2330f06fff6154cd3adc0f193dfabb00f92 From 6e215ae9e5c2856467c16e93b008b4658cec27e8 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Thu, 21 May 2026 06:42:10 -0700 Subject: [PATCH 6/8] use css animation instead of svg animation --- classes/WpMatomo/Admin/views/marketplace.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/classes/WpMatomo/Admin/views/marketplace.php b/classes/WpMatomo/Admin/views/marketplace.php index 43955d17b..1d10bc225 100644 --- a/classes/WpMatomo/Admin/views/marketplace.php +++ b/classes/WpMatomo/Admin/views/marketplace.php @@ -166,10 +166,20 @@ class="nav-tab