84% basic-google-analytics-4-for-wp

Code Review | Basic Google Analytics 4 for WP

WordPress plugin Basic Google Analytics 4 for WP scored84%from 54 tests.

About plugin

  • Plugin page: basic-google-anal...
  • Plugin version: 1.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.1.1
  • WordPress version: 6.3.1
  • First release: Dec 23, 2022
  • Latest release: Dec 23, 2022
  • Number of updates: 16
  • Update frequency: N/A
  • Top authors: zanychew (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /176 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼1.25ms] Passed 4 tests

Server-side resources used by Basic Google Analytics 4 for WP
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0147.36 ▲4.22
Dashboard /wp-admin3.32 ▲0.0149.03 ▼1.90
Posts /wp-admin/edit.php3.37 ▲0.0149.17 ▲5.36
Add New Post /wp-admin/post-new.php5.90 ▲0.0187.59 ▼10.10
Media Library /wp-admin/upload.php3.24 ▲0.0134.99 ▲2.78
Google Analytics /wp-admin/options-general.php?page=ga4forwp-plugin3.2028.81

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 5 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Basic Google Analytics 4 for WP
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲4713.20 ▼1.431.75 ▼0.3641.34 ▼9.17
Dashboard /wp-admin2,213 ▲285.79 ▲0.9295.40 ▼23.1338.33 ▼9.42
Posts /wp-admin/edit.php2,093 ▲42.05 ▲0.0441.25 ▲5.7934.70 ▼0.22
Add New Post /wp-admin/post-new.php1,537 ▲1823.42 ▲0.18697.00 ▲45.0454.51 ▲0.11
Media Library /wp-admin/upload.php1,389 ▲14.19 ▼0.0497.68 ▲2.6042.53 ▲2.71
Google Analytics /wp-admin/options-general.php?page=ga4forwp-plugin7902.0326.8724.61

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
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 75% from 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 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
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/basic-google-analytics-4-for-wp/ga4-admin.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/basic-google-analytics-4-for-wp/ga4forwp.php:14

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 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
2 plugin tags: analytics, google analytics 4

basic-google-analytics-4-for-wp/ga4forwp.php 92% from 13 tests

The principal PHP file in "Basic Google Analytics 4 for WP" v. 1.0 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("basic-google-analytics-4-for-wp.php" instead of "ga4forwp.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Good job! No executable or dangerous file extensions detected379 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
Markdown1800320
PHP3201459

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.25
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%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There were not PNG files found in your plugin