84% rs-google-analytics

Code Review | RS Google Analytics

WordPress plugin RS Google Analytics scored84%from 54 tests.

About plugin

  • Plugin page: rs-google-analytics
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-4.2
  • WordPress version: 6.3.1
  • First release: Apr 22, 2014
  • Latest release: Apr 20, 2015
  • Number of updates: 8
  • Update frequency: every 47.1 days
  • Top authors: rorystandley (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,036 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.00MB] [CPU: ▼6.89ms] Passed 4 tests

An overview of server-side resources used by RS Google Analytics
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.39 ▼0.0726.89 ▼14.54
Dashboard /wp-admin3.32 ▲0.0251.47 ▼1.78
Posts /wp-admin/edit.php3.37 ▲0.0252.75 ▲4.96
Add New Post /wp-admin/post-new.php5.90 ▲0.0293.24 ▼10.98
Media Library /wp-admin/upload.php3.25 ▲0.0237.17 ▼0.24

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 27 new files
Database: 1 new table, 7 new options
New tables
wp_rs_google_analytics
New WordPress options
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
rs_google_anal
widget_recent-posts
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

RS Google Analytics: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,923 ▲17713.60 ▼0.958.55 ▲6.5546.78 ▲3.75
Dashboard /wp-admin2,209 ▲214.91 ▼0.90102.55 ▼8.7273.67 ▲28.50
Posts /wp-admin/edit.php2,104 ▲152.01 ▲0.0038.61 ▲2.2134.14 ▼1.37
Add New Post /wp-admin/post-new.php1,536 ▲2223.06 ▲5.64695.30 ▲7.9063.08 ▲12.01
Media Library /wp-admin/upload.php1,397 ▲124.17 ▼0.06103.91 ▼10.0879.78 ▲28.22

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to a member function initPlugin() on null in wp-content/plugins/rs-google-analytics/public/views/public.php:10
    • > PHP Notice
      Undefined variable: myCode in wp-content/plugins/rs-google-analytics/public/views/public.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/rs-google-analytics/admin/views/admin.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 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
Please fix the following attributes:
  • Contributors: The plugin contributors field is not present
The official readme.txt is a good inspiration

rs-google-analytics/rs-google-analytics.php Passed 13 tests

The main PHP script in "RS Google Analytics" version 1.0.1 is automatically included on every request by WordPress
76 characters long description:
Allows you to add your Google Analytics code to either your header of footer

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
Success! There were no dangerous files found in this plugin361 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP89790294
JavaScript211261
CSS2026

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity6.33
▷ Minimum class complexity1.00
▷ Maximum class complexity12.00
Average method complexity1.53
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods30
▷ Static methods826.67%
▷ Public methods2583.33%
▷ Protected methods00.00%
▷ Private methods516.67%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/assets/images/small-icon.png3.74KB1.07KB▼ 71.44%
admin/assets/images/large-icon.png6.16KB1.80KB▼ 70.74%