84% show-google-analytics-widget

Code Review | Show Google Analytics widget

WordPress plugin Show Google Analytics widget scored84%from 54 tests.

About plugin

  • Plugin page: show-google-analy...
  • Plugin version: 1.5.4
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.8
  • WordPress version: 6.3.1
  • First release: Sep 19, 2017
  • Latest release: Oct 13, 2021
  • Number of updates: 38
  • Update frequency: every 39.1 days
  • Top authors: simon_tw (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /3,309 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.17MB] [CPU: ▼0.48ms] Passed 4 tests

An overview of server-side resources used by Show Google Analytics widget
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1746.43 ▲4.67
Dashboard /wp-admin3.47 ▲0.1751.32 ▼1.42
Posts /wp-admin/edit.php3.58 ▲0.2357.85 ▲5.81
Add New Post /wp-admin/post-new.php6.05 ▲0.1691.66 ▼8.81
Media Library /wp-admin/upload.php3.39 ▲0.1640.86 ▲3.65
設定 GA 帳號及參數 /wp-admin/options-general.php?page=sig-ga-account3.3833.61

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 19 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_sig-show-hot
widget_theysaidso_widget
can_compress_scripts
widget_sig-show-pageview
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

Show Google Analytics widget: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,860 ▲9913.21 ▼0.052.15 ▼2.3747.31 ▲1.66
Dashboard /wp-admin2,238 ▲355.80 ▲0.90106.32 ▼1.2646.31 ▲0.91
Posts /wp-admin/edit.php2,120 ▲202.04 ▼0.0040.64 ▲3.4945.68 ▲5.16
Add New Post /wp-admin/post-new.php1,561 ▲3523.42 ▲5.67634.35 ▼70.8665.98 ▲6.72
Media Library /wp-admin/upload.php1,423 ▲204.19 ▼0.1794.68 ▼23.1151.72 ▲3.71
設定 GA 帳號及參數 /wp-admin/options-general.php?page=sig-ga-account9852.0526.1693.38

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • widget_sig-show-hot
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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 take a closer look at the following
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/show-google-analytics-widget/class-ga-widget.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/show-google-analytics-widget/wp-ga-count.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% 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 need to be fixed:
  • Plugin Name: Please specify the plugin name on the first line ( === show-google-analytics-widget === )
The official readme.txt might help

show-google-analytics-widget/wp-ga-count.php 92% from 13 tests

"Show Google Analytics widget" version 1.5.4's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("show-google-analytics-widget.php" instead of "wp-ga-count.php")

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 detected1,343 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP103503291,326
HTML1209
JavaScript21135
CSS2063

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity24.33
▷ Minimum class complexity4.00
▷ Maximum class complexity89.00
Average method complexity3.96
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods69
▷ Static methods710.14%
▷ Public methods5985.51%
▷ Protected methods34.35%
▷ Private methods710.14%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants18
▷ Global constants738.89%
▷ Class constants1161.11%
▷ Public constants11100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
No PNG images were found in this plugin