84% sig-ga4-widget

Code Review | Sig GA4 Widget

WordPress plugin Sig GA4 Widget scored84%from 54 tests.

About plugin

  • Plugin page: sig-ga4-widget
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 5.9-6.0.2
  • WordPress version: 6.3.1
  • First release: Oct 8, 2022
  • Latest release: Oct 13, 2022
  • Number of updates: 8
  • Update frequency: every 0.6 days
  • Top authors: simon_tw (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /359 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.20MB] [CPU: ▼15.51ms] Passed 4 tests

Analyzing server-side resources used by Sig GA4 Widget
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.66 ▲0.2042.00 ▼4.00
Dashboard /wp-admin3.57 ▲0.2252.84 ▼12.44
Posts /wp-admin/edit.php3.62 ▲0.2651.45 ▼5.31
Add New Post /wp-admin/post-new.php6.08 ▲0.2090.53 ▼40.28
Media Library /wp-admin/upload.php3.43 ▲0.2042.47 ▲5.95
GA4 widget config /wp-admin/options-general.php?page=siga4w_setting3.4437.34

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 989 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
_siga4w_setting

Browser metrics Passed 4 tests

Sig GA4 Widget: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,913 ▲15213.80 ▼0.588.59 ▲5.6540.37 ▲2.54
Dashboard /wp-admin2,218 ▲385.63 ▼0.0287.31 ▼9.2641.68 ▼6.43
Posts /wp-admin/edit.php2,120 ▲201.96 ▼0.0536.47 ▼5.0531.80 ▼9.70
Add New Post /wp-admin/post-new.php1,542 ▲1623.09 ▼0.32675.17 ▲6.9962.30 ▲2.18
Media Library /wp-admin/upload.php1,420 ▲204.20 ▼0.02116.12 ▲3.5648.46 ▲2.25
GA4 widget config /wp-admin/options-general.php?page=siga4w_setting1,0891.6528.0680.93

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
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 477× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/sig-ga4-widget/vendor/google/longrunning/src/LongRunning/ListOperationsRequest.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/sig-ga4-widget/vendor/google/analytics-data/src/V1beta/DateRange.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/sig-ga4-widget/vendor/google/protobuf/src/Google/Protobuf/Type.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/sig-ga4-widget/vendor/google/common-protos/src/Type/Quaternion.php:58
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/sig-ga4-widget/vendor/google/common-protos/src/Api/Expr/V1alpha1/Value.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/sig-ga4-widget/vendor/google/protobuf/src/Google/Protobuf/Internal/TimestampBase.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Handler\\CurlFactoryInterface' not found in wp-content/plugins/sig-ga4-widget/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/sig-ga4-widget/vendor/google/longrunning/src/LongRunning/DeleteOperationRequest.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/sig-ga4-widget/vendor/google/analytics-data/src/V1beta/Filter.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/sig-ga4-widget/vendor/google/analytics-data/src/V1alpha/DimensionHeader.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 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
7 plugin tags: tracking, ga4, analytics, ga, pixnet...

sig-ga4-widget/sig-ga4-widget.php Passed 13 tests

The main PHP script in "Sig GA4 Widget" version 1.0.1 is automatically included on every request by WordPress
63 characters long description:
Use Google Analytics 4 data to display website pageviews widget

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected60,303 lines of code in 941 files:
LanguageFilesBlank linesComment linesLines of code
PHP86112,43358,93052,996
Markdown381,63404,761
JSON29002,215
PO File16682150
Protocol Buffers2143864
Python1164155
XML20132
Bourne Shell12011
YAML20011
JavaScript21135
CSS2063

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity5.66
▷ Minimum class complexity1.00
▷ Maximum class complexity435.00
Average method complexity1.70
▷ Minimum method complexity1.00
▷ Maximum method complexity75.00
Code structure
Namespaces123
Interfaces40
Traits17
Classes777
▷ Abstract classes50.64%
▷ Concrete classes77299.36%
▷ Final classes384.92%
Methods5,319
▷ Static methods56510.62%
▷ Public methods4,93392.74%
▷ Protected methods440.83%
▷ Private methods3426.43%
Functions184
▷ Named functions5831.52%
▷ Anonymous functions12668.48%
Constants514
▷ Global constants101.95%
▷ Class constants50498.05%
▷ Public constants48596.23%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.62MB with 0.42MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png634.56KB200.82KB▼ 68.35%