84% plausible-analytics

Code Review | Plausible Analytics

WordPress plugin Plausible Analytics scored84%from 54 tests.

About plugin

  • Plugin page: plausible-analytics
  • Plugin version: 1.3.6
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-6.4
  • WordPress version: 6.3.1
  • First release: Oct 4, 2020
  • Latest release: Nov 13, 2023
  • Number of updates: 44
  • Update frequency: every 25.8 days
  • Top authors: mehul0810 (65.91%)plausible (36.36%)

Code review

54 tests

User reviews

24 reviews

Install metrics

8,000+ active /69,526 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.40MB] [CPU: ▼0.37ms] Passed 4 tests

Analyzing server-side resources used by Plausible Analytics
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.2142.18 ▼2.69
Dashboard /wp-admin3.81 ▲0.5152.81 ▲4.85
Posts /wp-admin/edit.php3.86 ▲0.5049.11 ▼1.48
Add New Post /wp-admin/post-new.php6.35 ▲0.4688.55 ▼2.14
Media Library /wp-admin/upload.php3.67 ▲0.4441.80 ▲9.33
Analytics /wp-admin/index.php?page=plausible_analytics_statistics3.6441.93
Plausible Analytics /wp-admin/options-general.php?page=plausible_analytics3.6438.23

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 41 new files
Database: no new tables, 10 new options
New WordPress options
widget_recent-comments
plausible_analytics_proxy_resources
plausible_analytics_is_default_settings_saved
widget_recent-posts
can_compress_scripts
plausible_analytics_settings
plausible_analytics_version
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Plausible Analytics
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,831 ▲4414.33 ▼0.021.86 ▲0.0844.50 ▲3.44
Dashboard /wp-admin2,225 ▲485.63 ▼0.0285.05 ▼14.1136.92 ▼5.85
Posts /wp-admin/edit.php2,124 ▲211.98 ▲0.0035.62 ▼5.6935.77 ▼4.17
Add New Post /wp-admin/post-new.php1,545 ▲1923.09 ▲0.00693.90 ▲87.3454.91 ▲3.39
Media Library /wp-admin/upload.php1,424 ▲274.23 ▲0.02100.84 ▼6.3343.54 ▲0.36
Analytics /wp-admin/index.php?page=plausible_analytics_statistics8262.0024.2332.39
Plausible Analytics /wp-admin/options-general.php?page=plausible_analytics1,2802.0222.8342.77

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 50% 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
Almost there! Just fix the following items
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Plausible\\Analytics\\WP\\Admin\\Settings\\wp_die() in wp-content/plugins/plausible-analytics/src/Admin/Settings/API.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Plausible\\Analytics\\WP\\Admin\\Settings\\wp_die() in wp-content/plugins/plausible-analytics/src/Admin/Settings/Page.php:17

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed: You can look at the official readme.txt

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

The main file in "Plausible Analytics" v. 1.3.6 serves as a complement to information provided in readme.txt and as the entry point to the plugin
60 characters long description:
Simple and privacy-friendly alternative to Google Analytics.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected2,301 lines of code in 35 files:
LanguageFilesBlank linesComment linesLines of code
PHP304791,4092,141
JSON100154
YAML1003
CSS2022
JavaScript1011

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity13.52
▷ Minimum class complexity1.00
▷ Maximum class complexity48.00
Average method complexity2.96
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces6
Interfaces0
Traits0
Classes21
▷ Abstract classes00.00%
▷ Concrete classes21100.00%
▷ Final classes14.76%
Methods136
▷ Static methods3727.21%
▷ Public methods11685.29%
▷ Protected methods00.00%
▷ Private methods2014.71%
Functions2
▷ Named functions00.00%
▷ Anonymous functions2100.00%
Constants7
▷ Global constants571.43%
▷ Class constants228.57%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/dist/images/icon.png4.23KB3.68KB▼ 12.86%