77% wd-google-analytics

Code Review | 10WebAnalytics

WordPress plugin 10WebAnalytics scored 77% from 54 tests.

About plugin

  • Plugin page: wd-google-analytics
  • Plugin version: 1.2.12
  • PHP version: 7.4.16
  • WordPress compatibility: 3.9-5.6
  • WordPress version: 5.8.1
  • First release: Aug 12, 2016
  • Latest release: Sep 6, 2021
  • Number of updates: 131
  • Update frequency: every 14.1 days
  • Top authors: webdorado (92.37%)10web (8.4%)

Code review

54 tests

User reviews

96 reviews

Install metrics

9,000+ active / 352,726 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.66MB] [CPU: ▼108.65ms] Passed 4 tests

A check of server-side resources used by 10WebAnalytics
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.37 ▲0.6585.20 ▲62.79
Dashboard /wp-admin3.73 ▲0.6893.91 ▲47.57
Posts /wp-admin/edit.php3.85 ▲0.7487.97 ▲31.79
Add New Post /wp-admin/post-new.php6.09 ▲0.65136.39 ▼518.37
Media Library /wp-admin/upload.php3.66 ▲0.6642.79 ▲4.43

Server storage [IO: ▲7.63MB] [DB: ▲0.01MB] Passed 3 tests

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 834 new files
Database: no new tables, 5 new options
New WordPress options
gawd_version
gawd_settings
gawd_admin_notice
gawd_menu_items
gawd_credentials

Browser metrics Passed 4 tests

This is an overview of browser requirements for 10WebAnalytics
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,701 ▲10517.17 ▲1.579.06 ▼0.3753.33 ▲9.53
Dashboard /wp-admin2,987 ▲537.64 ▲1.68150.92 ▲1.53133.71 ▲3.37
Posts /wp-admin/edit.php2,749 ▲104.19 ▲1.3572.69 ▼7.8989.28 ▼6.42
Add New Post /wp-admin/post-new.php1,516 ▲1819.17 ▲0.42367.14 ▲1.72159.38 ▲49.87
Media Library /wp-admin/upload.php1,775 ▼386.47 ▲1.44134.88 ▼10.67142.14 ▲23.20

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options were found after uninstall: 5 options
    • gawd_settings
    • gawd_credentials
    • gawd_version
    • gawd_menu_items
    • gawd_admin_notice

Smoke tests 50% 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)
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 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
Almost there! Just fix the following items
  • 5× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/wd-google-analytics/admin/pages/real_time.php
    • > /wp-content/plugins/wd-google-analytics/admin/pages/browser.php
    • > /wp-content/plugins/wd-google-analytics/admin/pages/logs.php
    • > /wp-content/plugins/wd-google-analytics/admin/pages/location.php
    • > /wp-content/plugins/wd-google-analytics/admin/pages/visitors.php
  • 410× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Warning
      Use of undefined constant GAWD_URL - assumed 'GAWD_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/wd-google-analytics/admin/pages/visitors.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Processor\\MemoryProcessor' not found in wp-content/plugins/wd-google-analytics/google/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php:20
    • > PHP Notice
      Undefined variable: tabs in wp-content/plugins/wd-google-analytics/admin/pages/dashboard_menu.php on line 121
    • > PHP Warning
      Use of undefined constant GAWD_URL - assumed 'GAWD_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/wd-google-analytics/admin/pages/real_time.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\SocketHandler' not found in wp-content/plugins/wd-google-analytics/google/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Stream\\StreamInterface' not found in wp-content/plugins/wd-google-analytics/google/vendor/guzzlehttp/streams/src/AsyncReadStream.php:22
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/wd-google-analytics/google/vendor/psr/http-message/src/ResponseInterface.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/wd-google-analytics/admin/pages/overview.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\GroupHandler' not found in wp-content/plugins/wd-google-analytics/google/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Event\\EventInterface' not found in wp-content/plugins/wd-google-analytics/google/vendor/guzzlehttp/guzzle/src/Event/AbstractEvent.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention:
  • Screenshots: Please add descriptions for these screenshots #1, #2, #3, #4, #5, #6 in wd-google-analytics/assets to your readme.txt
Please take inspiration from this readme.txt

wd-google-analytics/google-analytics-wd.php 92% from 13 tests

"10WebAnalytics" version 1.2.12's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wd-google-analytics.php" instead of "google-analytics-wd.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin94,956 lines of code in 701 files:
LanguageFilesBlank linesComment linesLines of code
PHP5609,69429,75861,886
CSS2077530513,682
JavaScript291,79275812,741
Markdown291,27204,093
JSON15001,200
reStructuredText9263333517
XML122621285
make4455181
YAML10414165
Bourne Shell72646127
SVG40134
Ant14226
Python14019

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 170)
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity14.65
▷ Minimum class complexity1.00
▷ Maximum class complexity549.00
Average method complexity2.69
▷ Minimum method complexity1.00
▷ Maximum method complexity170.00
Code structure
Namespaces34
Interfaces39
Traits18
Classes463
▷ Abstract classes132.81%
▷ Concrete classes45097.19%
▷ Final classes40.89%
Methods4,396
▷ Static methods2054.66%
▷ Public methods3,97890.49%
▷ Protected methods1633.71%
▷ Private methods2555.80%
Functions163
▷ Named functions4829.45%
▷ Anonymous functions11570.55%
Constants346
▷ Global constants24470.52%
▷ Class constants10229.48%
▷ Public constants102100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
87 PNG files occupy 1.25MB with 0.68MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/css/images/arrow3.png0.73KB0.66KB▼ 9.71%
wd/assets/css/img/ug-icon-1.png1.56KB0.54KB▼ 65.79%
wd/assets/img/how_it_works.png331.66KB187.47KB▼ 43.48%
assets/lines.png0.96KB0.11KB▼ 88.11%
wd/assets/css/img/skip.png1.81KB0.65KB▼ 64.33%