72% metrics-query

Code Review | Metrics Query

WordPress plugin Metrics Query scored72%from 54 tests.

About plugin

  • Plugin page: metrics-query
  • Plugin version: 1.0.3
  • PHP compatiblity: 5.6.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-5.7.1
  • WordPress version: 6.3.1
  • First release: Feb 22, 2020
  • Latest release: Apr 30, 2021
  • Number of updates: 13
  • Update frequency: every 33.4 days
  • Top authors: yehudah (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

300+ active /3,929 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.77MB] [CPU: ▲4.56ms] Passed 4 tests

An overview of server-side resources used by Metrics Query
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.95 ▲0.4943.41 ▲5.46
Dashboard /wp-admin4.19 ▲0.8957.89 ▲9.89
Posts /wp-admin/edit.php4.23 ▲0.8757.52 ▲10.48
Add New Post /wp-admin/post-new.php6.71 ▲0.8290.40 ▼5.31
Media Library /wp-admin/upload.php4.19 ▲0.9640.80 ▲8.21
Frontend Settings /wp-admin/admin.php?page=gadwp_frontend_settings4.1937.69
General Settings /wp-admin/admin.php?page=gadwp_settings6.5945.14
Backend Settings /wp-admin/admin.php?page=gadwp_backend_settings4.1935.26
Errors & Debug /wp-admin/admin.php?page=gadwp_errors_debugging4.1937.25
Tracking Code /wp-admin/admin.php?page=gadwp_tracking_settings4.1935.05

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 132 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-posts
can_compress_scripts
gadwp_options
theysaidso_admin_options
db_upgraded
widget_recent-comments
widget_gadwp-frontwidget-report
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Metrics Query
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,951 ▲20515.72 ▲1.341.77 ▼0.0741.85 ▼0.44
Dashboard /wp-admin2,367 ▲1767.34 ▲1.54128.16 ▲23.1940.97 ▼2.90
Posts /wp-admin/edit.php2,197 ▲1053.98 ▲1.9650.69 ▲9.7375.59 ▲39.23
Add New Post /wp-admin/post-new.php1,552 ▲1023.35 ▲5.18647.27 ▲9.9053.46 ▲6.18
Media Library /wp-admin/upload.php1,437 ▲494.25 ▲0.0394.93 ▼7.5544.10 ▼1.32
Frontend Settings /wp-admin/admin.php?page=gadwp_frontend_settings1,1443.7298.2545.00
General Settings /wp-admin/admin.php?page=gadwp_settings1,0903.6978.5330.67
Backend Settings /wp-admin/admin.php?page=gadwp_backend_settings1,2623.6973.1232.54
Errors & Debug /wp-admin/admin.php?page=gadwp_errors_debugging1,1433.6971.3435.89
Tracking Code /wp-admin/admin.php?page=gadwp_tracking_settings2,9923.7572.2537.07

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_gadwp-frontwidget-report
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Almost there, just fix the following server-side errors
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=gadwp_tracking_settings
    • > Notice in wp-content/plugins/metrics-query/admin/settings.php+437
    Trying to access array offset on value of type null

SRP 0% 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
  • 7× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/metrics-query/front/views/analytics-optout-code.php
    • > /wp-content/plugins/metrics-query/front/views/optimize-code.php
    • > /wp-content/plugins/metrics-query/front/views/tagmanager-code.php
    • > /wp-content/plugins/metrics-query/front/views/tagmanager-amp-code.php
    • > /wp-content/plugins/metrics-query/front/views/analytics-amp-clientidapi.php
    • > /wp-content/plugins/metrics-query/front/views/analytics-code.php
    • > /wp-content/plugins/metrics-query/front/views/analytics-amp-code.php
  • 28× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/metrics-query/front/views/analytics-code.php on line 17
    • > PHP Notice
      Undefined variable: data in wp-content/plugins/metrics-query/front/views/analytics-optout-code.php on line 12
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/metrics-query/front/views/tagmanager-code.php on line 13
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/metrics-query/front/views/analytics-code.php on line 18
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/metrics-query/front/views/tagmanager-amp-code.php on line 12
    • > PHP Notice
      Undefined variable: data in wp-content/plugins/metrics-query/front/views/analytics-code.php on line 17
    • > PHP Notice
      Undefined variable: data in wp-content/plugins/metrics-query/front/views/optimize-code.php on line 20
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/metrics-query/front/views/analytics-optout-code.php on line 12
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/metrics-query/front/views/analytics-amp-code.php on line 12
    • > PHP Notice
      Undefined variable: data in wp-content/plugins/metrics-query/front/views/tagmanager-amp-code.php on line 12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #4 (Google Analytics Dashboard for WP Geo Map), #5 (Google Analytics Dashboard for WP Top Pages, Top Referrers and Top Searches), #6 (Google Analytics Dashboard for WP Traffic Overview), #7 (Google Analytics Dashboard for WP statistics per page on Frontend), #8 (Google Analytics Dashboard for WP cities on region map), #9 (Google Analytics Dashboard for WP Widget)
The official readme.txt might help

metrics-query/gadwp.php 77% from 13 tests

The main PHP script in "Metrics Query" version 1.0.3 is automatically included on every request by WordPress
The following require your attention:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Description: Please don't use more than 140 characters for the plugin description (currently 148 characters long)
  • Main file name: Name the main plugin file the same as the plugin slug ("metrics-query.php" instead of "gadwp.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected19,161 lines of code in 94 files:
LanguageFilesBlank linesComment linesLines of code
PHP751,7974,74918,098
JavaScript11101,055
CSS8048

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity8.19
▷ Minimum class complexity1.00
▷ Maximum class complexity193.00
Average method complexity1.79
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes188
▷ Abstract classes63.19%
▷ Concrete classes18296.81%
▷ Final classes126.59%
Methods1,727
▷ Static methods492.84%
▷ Public methods1,63794.79%
▷ Protected methods241.39%
▷ Private methods663.82%
Functions5
▷ Named functions360.00%
▷ Anonymous functions240.00%
Constants57
▷ Global constants58.77%
▷ Class constants5291.23%
▷ Public constants52100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
34 compressed PNG files occupy 0.11MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
common/realtime/images/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%
common/realtime/images/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
admin/images/gadwp-icon.png0.34KB0.27KB▼ 19.08%
common/realtime/images/ui-icons_888888_256x240.png4.27KB4.11KB▼ 3.78%
realtime/jquery/images/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%