78% official-statcounter-plugin-for-wordpress

Code Review | StatCounter - Free Real Time Visitor Stats

WordPress plugin StatCounter - Free Real Time Visitor Stats scored78%from 54 tests.

About plugin

  • Plugin page: official-statcoun...
  • Plugin version: 2.0.9
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0.2-6.1
  • WordPress version: 6.3.1
  • First release: Feb 11, 2008
  • Latest release: Jan 19, 2023
  • Number of updates: 89
  • Update frequency: every 61.4 days
  • Top authors: StatCounter (100%)

Code review

54 tests

User reviews

47 reviews

Install metrics

100,000+ active /1,779,380 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼5.23ms] Passed 4 tests

A check of server-side resources used by StatCounter - Free Real Time Visitor Stats
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0540.28 ▲2.64
Dashboard /wp-admin3.35 ▲0.0051.01 ▼6.73
Posts /wp-admin/edit.php3.40 ▲0.0445.48 ▼1.04
Add New Post /wp-admin/post-new.php5.93 ▲0.0487.27 ▼12.75
Media Library /wp-admin/upload.php3.27 ▲0.0435.97 ▼0.38
StatCounter Stats /wp-admin/index.php?page=statcounter3.2431.55
StatCounter Admin /wp-admin/plugins.php?page=statcounter_admin3.2435.06

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 4 new files
Database: no new tables, 9 new options
New WordPress options
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
widget_recent-posts
sc_invisible
key_sc_security
sc_project

Browser metrics Passed 4 tests

An overview of browser requirements for StatCounter - Free Real Time Visitor Stats
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,801 ▲5514.17 ▼0.231.79 ▲0.2843.32 ▲4.50
Dashboard /wp-admin2,207 ▲265.57 ▼0.1394.77 ▼3.8642.85 ▲2.04
Posts /wp-admin/edit.php2,109 ▲91.95 ▼0.0334.94 ▼1.0534.77 ▼4.67
Add New Post /wp-admin/post-new.php1,535 ▲923.23 ▲0.15627.83 ▼61.7649.01 ▲0.98
Media Library /wp-admin/upload.php1,415 ▲124.22 ▲0.0495.06 ▼4.2740.42 ▼4.93
StatCounter /wp-admin/StatCounter-Wordpress-Plugin.php260.420.1113.48
StatCounter Stats /wp-admin/index.php?page=statcounter3,63311.63220.59138.42
StatCounter Admin /wp-admin/plugins.php?page=statcounter_admin9172.0322.6329.71

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
Please fix the following items
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • sc_invisible
    • key_sc_security
    • can_compress_scripts
    • widget_recent-posts
    • sc_project
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

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
The following issues need your attention
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_option() in wp-content/plugins/official-statcounter-plugin-for-wordpress/StatCounter-Wordpress-Plugin.php:22

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
These are user-side errors you should fix
    • > GET request to /wp-admin/StatCounter-Wordpress-Plugin.php
    • > Network (severe)
    wp-admin/StatCounter-Wordpress-Plugin.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/index.php?page=statcounter
    • > Javascript (severe) in unknown
    https://statcounter.com/ - Access to XMLHttpRequest at 'https://1ctest.statcounter.com/t_static.php?sc_project=204609&u1=ACC0D48BA35B4F35E24B0ABE9E2675E5&java=1&security=0c932f53&sc_snum=2&sess=fa3364&p=0&rcat=r&bb=0&rdomo=wp.com&rdomg=0&jg=new&rr=1.1.1.1.1.1.1.1.1&resolution=800&h=600&camefrom=http%3A//wp.com/&u=https%3A//statcounter.com/&t=Web%20Analytics%20Made%20Easy%20-%20Statcounter&invisible=1&sc_rum_e_s=1536&sc_rum_e_e=1538&sc_ev_scperf_js_exec=2&sc_ev_scperf_ttfb_frontend=709&sc_ev_scperf_ttfb_backend=56.746959686279&sc_ev_scperf_ws=webd004&sc_ev_scperf_pn=0&sc_ev_scperf_db=0&sc_rum_f_s=1475&sc_rum_f_e=1523&get_config=true' from origin 'https://statcounter.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
    • > GET request to /wp-admin/index.php?page=statcounter
    • > Network (severe)
    https://1ctest.statcounter.com/t_static.php?sc_project=204609&u1=ACC0D48BA35B4F35E24B0ABE9E2675E5&java=1&security=0c932f53&sc_snum=2&sess=fa3364&p=0&rcat=r&bb=0&rdomo=wp.com&rdomg=0&jg=new&rr=1.1.1.1.1.1.1.1.1&resolution=800&h=600&camefrom=http%3A//wp.com/&u=https%3A//statcounter.com/&t=Web%20Analytics%20Made%20Easy%20-%20Statcounter&invisible=1&sc_rum_e_s=1536&sc_rum_e_e=1538&sc_ev_scperf_js_exec=2&sc_ev_scperf_ttfb_frontend=709&sc_ev_scperf_ttfb_backend=56.746959686279&sc_ev_scperf_ws=webd004&sc_ev_scperf_pn=0&sc_ev_scperf_db=0&sc_rum_f_s=1475&sc_rum_f_e=1523&get_config=true - Failed to load resource: net::ERR_FAILED

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Screenshots: These screenshots require images: #1 (Example StatCounter.com Summary Stats), #2 (Using the magnify tool, you can "zoom in" on individual visitors and get a detailed report on where they are from, their system settings, and most importantly, what link reffered them to your site and their navigation path through your site.)
You can look at the official readme.txt

official-statcounter-plugin-for-wordpress/StatCounter-Wordpress-Plugin.php 85% from 13 tests

This is the main PHP file of "StatCounter - Free Real Time Visitor Stats" version 2.0.9, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("official-statcounter-plugin-for-wordpress.php" instead of "StatCounter-Wordpress-Plugin.php")
  • Description: Please keep the plugin description shorter than 140 characters (currently 256 characters long)

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 detected241 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP13523241

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.21MB with 0.14MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png70.43KB28.44KB▼ 59.62%
screenshot-2.png146.54KB44.22KB▼ 69.83%