84% koko-analytics

Code Review | Koko Analytics

WordPress plugin Koko Analytics scored84%from 54 tests.

About plugin

  • Plugin page: koko-analytics
  • Plugin version: 1.3.4
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.4
  • WordPress version: 6.3.1
  • First release: Nov 5, 2019
  • Latest release: Nov 21, 2023
  • Number of updates: 153
  • Update frequency: every 9.7 days
  • Top authors: DvanKooten (100%)

Code review

54 tests

User reviews

107 reviews

Install metrics

30,000+ active /537,039 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.35MB] [CPU: ▲2.16ms] Passed 4 tests

This is a short check of server-side resources used by Koko Analytics
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.83 ▲0.3739.97 ▼1.03
Dashboard /wp-admin3.71 ▲0.4153.94 ▲3.15
Posts /wp-admin/edit.php3.74 ▲0.3852.60 ▲4.99
Add New Post /wp-admin/post-new.php6.23 ▲0.3489.22 ▲3.18
Media Library /wp-admin/upload.php3.55 ▲0.3239.22 ▲3.34

Server storage [IO: ▲0.86MB] [DB: ▲0.53MB] Passed 3 tests

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 73 new files
Database: 5 new tables, 10 new options
New tables
wp_koko_analytics_referrer_stats
wp_koko_analytics_post_stats
wp_koko_analytics_referrer_urls
wp_koko_analytics_dates
wp_koko_analytics_site_stats
New WordPress options
widget_recent-comments
widget_koko-analytics-most-viewed-posts
theysaidso_admin_options
koko_analytics_version
can_compress_scripts
db_upgraded
widget_recent-posts
widget_theysaidso_widget
koko_analytics_use_custom_endpoint
activate_plugins

Browser metrics Passed 4 tests

An overview of browser requirements for Koko Analytics
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,038 ▲30214.81 ▲0.103.77 ▲2.0937.47 ▼7.12
Dashboard /wp-admin2,402 ▲2255.77 ▲0.13113.73 ▲17.7844.77 ▼1.39
Posts /wp-admin/edit.php2,107 ▲72.03 ▲0.0237.39 ▲0.2435.00 ▲4.26
Add New Post /wp-admin/post-new.php1,529 ▲323.37 ▼0.21659.71 ▲48.8962.83 ▲5.26
Media Library /wp-admin/upload.php1,407 ▲44.18 ▲0.0396.51 ▼0.8940.83 ▼4.85

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin does not fully uninstall, leaving 8 options in the database
    • can_compress_scripts
    • widget_koko-analytics-most-viewed-posts
    • widget_theysaidso_widget
    • activate_plugins
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 4× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function update_option() in wp-content/plugins/koko-analytics/migrations/1.0.21-unlink-custom-endpoint-and-update-option.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/koko-analytics/src/class-widget-most-viewed-posts.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function KokoAnalytics\\is_admin() in wp-content/plugins/koko-analytics/koko-analytics.php:49
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/koko-analytics/src/views/nav.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: statistics, stats, analytics, pageviews, privacy

koko-analytics/koko-analytics.php Passed 13 tests

"Koko Analytics" version 1.3.4's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
51 characters long description:
Privacy-friendly analytics for your WordPress site.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin3,517 lines of code in 54 files:
LanguageFilesBlank linesComment linesLines of code
PHP475578362,807
CSS1159400
Markdown11560305
JavaScript4014
SVG1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity13.60
▷ Minimum class complexity1.00
▷ Maximum class complexity48.00
Average method complexity2.89
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes20
▷ Abstract classes00.00%
▷ Concrete classes20100.00%
▷ Final classes00.00%
Methods132
▷ Static methods1914.39%
▷ Public methods11486.36%
▷ Protected methods10.76%
▷ Private methods1712.88%
Functions29
▷ Named functions1862.07%
▷ Anonymous functions1137.93%
Constants4
▷ Global constants375.00%
▷ Class constants125.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
12 PNG files occupy 0.55MB with 0.32MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/dist/img/banner-1544x500.png29.50KB11.66KB▼ 60.49%
assets/dist/img/icon-256x256.png7.02KB3.29KB▼ 53.17%
assets/dist/img/screenshot-3.png95.91KB25.30KB▼ 73.62%
assets/dist/img/icon-128x128.png3.49KB2.24KB▼ 35.81%
assets/dist/img/icon-512.png16.14KB5.93KB▼ 63.28%