79% ga-for-wp

Code Review | Google Analytics WordPress Plugin by GA4WP

WordPress plugin Google Analytics WordPress Plugin by GA4WP scored79%from 54 tests.

About plugin

  • Plugin page: ga-for-wp
  • Plugin version: 2.2.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7.0-6.4
  • WordPress version: 6.3.1
  • First release: Jan 23, 2021
  • Latest release: Nov 21, 2023
  • Number of updates: 30
  • Update frequency: every 34.7 days
  • Top authors: passionatebrains (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

2,000+ active /19,086 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲5.51MB] [CPU: ▲25.48ms] 75% from 4 tests

A check of server-side resources used by Google Analytics WordPress Plugin by GA4WP
It is recommended to improve the following
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 5.51MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.26 ▲5.7968.43 ▲29.13
Dashboard /wp-admin9.28 ▲5.9373.98 ▲7.40
Posts /wp-admin/edit.php9.28 ▲5.9288.83 ▲40.19
Add New Post /wp-admin/post-new.php10.28 ▲4.39123.48 ▲26.93
Media Library /wp-admin/upload.php9.28 ▲6.0571.37 ▲38.46
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius9.2865.45

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 219 new files
Database: no new tables, 10 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
fs_active_plugins
can_compress_scripts
ga4wp_review_request_time
widget_recent-comments
fs_debug_mode
theysaidso_admin_options
fs_accounts

Browser metrics Passed 4 tests

An overview of browser requirements for Google Analytics WordPress Plugin by GA4WP
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,827 ▲8014.34 ▲0.071.71 ▼0.1229.74 ▼13.35
Dashboard /wp-admin2,220 ▲425.58 ▼0.0494.92 ▼15.4380.47 ▲37.68
Posts /wp-admin/edit.php2,138 ▲382.02 ▲0.0138.53 ▼1.9341.49 ▲5.34
Add New Post /wp-admin/post-new.php1,549 ▲2323.07 ▼0.32607.20 ▼28.61165.68 ▲111.85
Media Library /wp-admin/upload.php1,440 ▲404.25 ▲0.0796.35 ▲3.0575.15 ▲32.20
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius1,1021.6730.9031.93

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/ga-for-wp/freemius/includes/class-freemius.php+8546
    Undefined property: stdClass::$plugins
  • This plugin did not uninstall successfully, leaving 10 options in the database
    • widget_recent-posts
    • fs_accounts
    • theysaidso_admin_options
    • ga4wp_review_request_time
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • fs_debug_mode
    • fs_active_plugins

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though no errors were found, this is by no means an exhaustive test

SRP Passed 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
Congratulations! This plugin passed the SRP test

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
7 plugin tags: gtag, wordpress, google analytics dashboard, analytics plugin, google analytics...

ga-for-wp/ga-for-wp.php 85% from 13 tests

This is the main PHP file of "Google Analytics WordPress Plugin by GA4WP" version 2.2.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Requires at least: Required version does not match the one declared in readme.txt ("5.0" instead of "3.7.0")
  • Description: The description should be shorter than 140 characters (currently 244 characters long)

Code Analysis 97% from 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
No dangerous file extensions were detected38,940 lines of code in 163 files:
LanguageFilesBlank linesComment linesLines of code
PHP1368,35717,75238,150
JavaScript1134153360
CSS15012216
Markdown1680214

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Please fix the following
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 3,096)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity82.44
▷ Minimum class complexity1.00
▷ Maximum class complexity3,096.00
Average method complexity4.63
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes61
▷ Abstract classes34.92%
▷ Concrete classes5895.08%
▷ Final classes00.00%
Methods1,417
▷ Static methods20214.26%
▷ Public methods98569.51%
▷ Protected methods312.19%
▷ Private methods40128.30%
Functions103
▷ Named functions10198.06%
▷ Anonymous functions21.94%
Constants153
▷ Global constants10568.63%
▷ Class constants4831.37%
▷ Public constants48100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
14 PNG files occupy 0.19MB with 0.13MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assests/images/close.png15.54KB0.51KB▼ 96.71%
assests/images/GA4WPFevicon.png2.32KB0.63KB▼ 72.76%
assests/images/icon-1.png3.88KB1.95KB▼ 49.82%
assests/images/google-icon.png107.26KB35.91KB▼ 66.52%
assests/images/icon-6.png2.02KB1.03KB▼ 48.98%