78% wp-piwik

Code Review | Connect Matomo (WP-Matomo, WP-Piwik)

WordPress plugin Connect Matomo (WP-Matomo, WP-Piwik) scored78%from 54 tests.

About plugin

  • Plugin page: wp-piwik
  • Plugin version: 1.0.30
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Jun 4, 2009
  • Latest release: Sep 22, 2023
  • Number of updates: 654
  • Update frequency: every 8.0 days
  • Top authors: Braekling (100%)

Code review

54 tests

User reviews

92 reviews

Install metrics

60,000+ active /2,544,168 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.58MB] [CPU: ▼1.63ms] 75% from 4 tests

Analyzing server-side resources used by Connect Matomo (WP-Matomo, WP-Piwik)
It is recommended to improve the following
  • CPU: The total CPU usage must kept under 500.00ms (currently 1,643.70ms on /wp-admin/options-general.php?page=wp-piwik/classes/WP_Piwik.php)
PageMemory (MB)CPU Time (ms)
Home /3.85 ▲0.3946.38 ▲6.17
Dashboard /wp-admin3.99 ▲0.6458.37 ▼2.45
Posts /wp-admin/edit.php4.04 ▲0.6855.51 ▲5.54
Add New Post /wp-admin/post-new.php6.51 ▲0.6295.37 ▼15.77
Media Library /wp-admin/upload.php3.93 ▲0.7051.46 ▲15.17
Connect Matomo /wp-admin/options-general.php?page=wp-piwik/classes/WP_Piwik.php3.931,643.70

Server storage [IO: ▲2.27MB] [DB: ▲0.00MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 144 new files
Database: no new tables, 54 new options
New WordPress options
can_compress_scripts
wp-piwik_global-track_user_id
widget_recent-comments
wp-piwik-dashboard_revision
wp-piwik_global-filter_limit
wp-piwik-site_id
wp-piwik_global-add_download_extensions
wp-piwik_global-set_link_classes
wp-piwik_global-track_content
wp-piwik_global-capability_stealth
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for Connect Matomo (WP-Matomo, WP-Piwik)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,801 ▲5514.28 ▲0.311.68 ▲0.0948.70 ▲5.40
Dashboard /wp-admin2,202 ▲345.61 ▲0.0488.12 ▼0.7839.71 ▼4.27
Posts /wp-admin/edit.php2,104 ▲12.04 ▲0.0639.60 ▼2.0836.11 ▼5.61
Add New Post /wp-admin/post-new.php1,529 ▲323.46 ▼0.15683.08 ▲27.2854.41 ▼2.24
Media Library /wp-admin/upload.php1,407 ▲104.22 ▲0.0396.73 ▼6.5742.45 ▲0.49
Connect Matomo /wp-admin/options-general.php?page=wp-piwik/classes/WP_Piwik.php2,7422.0223.3824.83

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 16 options
    • wp-piwik_global-set_link_classes
    • wp-piwik_global-filter_limit
    • widget_recent-comments
    • wp-piwik_global-track_heartbeat
    • wp-piwik_global-http_method
    • widget_recent-posts
    • wp-piwik_global-http_connection
    • wp-piwik_global-set_download_extensions
    • db_upgraded
    • widget_theysaidso_widget
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/wp-piwik/proxy/matomo.php
    • > /wp-content/plugins/wp-piwik/proxy/piwik.php
  • 43× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Piwik\\Template' not found in wp-content/plugins/wp-piwik/classes/WP_Piwik/Template/MetaBoxCustomVars.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Piwik\\Widget' not found in wp-content/plugins/wp-piwik/classes/WP_Piwik/Widget/Plugins.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Piwik\\Widget' not found in wp-content/plugins/wp-piwik/classes/WP_Piwik/Widget/Post.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Piwik\\Widget' not found in wp-content/plugins/wp-piwik/classes/WP_Piwik/Widget/Types.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Piwik\\Admin' not found in wp-content/plugins/wp-piwik/classes/WP_Piwik/Admin/Statistics.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Piwik\\Widget' not found in wp-content/plugins/wp-piwik/classes/WP_Piwik/Widget/Country.php:7
    • > PHP Fatal error
      Uncaught Error: Cannot access self:: when no class scope is active in wp-content/plugins/wp-piwik/update/2015051101.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Piwik\\Widget\\Visitors' not found in wp-content/plugins/wp-piwik/classes/WP_Piwik/Widget/Chart.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Piwik\\Admin' not found in wp-content/plugins/wp-piwik/classes/WP_Piwik/Admin/Settings.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function delete_option() in wp-content/plugins/wp-piwik/update/91006.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • Screenshots: These screenshots require images: #1 (WP-Matomo settings.), #2 (WP-Matomo statistics page.), #3 (Closer look to a pie chart.), #4 (WordPress toolbar graph.), #5 (Matomo: Here you'll find your auth token.)
You can take inspiration from this readme.txt

wp-piwik/wp-piwik.php Passed 13 tests

The entry point to "Connect Matomo (WP-Matomo, WP-Piwik)" version 1.0.30 is a PHP file that has certain tags in its header comment area
113 characters long description:
Adds Matomo statistics to your WordPress dashboard and is also able to add the Matomo Tracking Code to your blog.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected26,437 lines of code in 96 files:
LanguageFilesBlank linesComment linesLines of code
PO File299,01711,50821,378
PHP586359724,380
HTML11250567
CSS115059
Markdown317037
JavaScript20116
Bourne Shell1005
XML1005

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity19.12
▷ Minimum class complexity1.00
▷ Maximum class complexity178.00
Average method complexity4.21
▷ Minimum method complexity1.00
▷ Maximum method complexity68.00
Code structure
Namespaces6
Interfaces0
Traits0
Classes43
▷ Abstract classes49.30%
▷ Concrete classes3990.70%
▷ Final classes00.00%
Methods249
▷ Static methods114.42%
▷ Public methods14056.22%
▷ Protected methods3514.06%
▷ Private methods7429.72%
Functions16
▷ Named functions1275.00%
▷ Anonymous functions425.00%
Constants9
▷ Global constants9100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
bitcoin.png1.97KB0.78KB▼ 60.54%