72% google-pagespeed-insights

Code Review | Insights from Google PageSpeed

WordPress plugin Insights from Google PageSpeed scored72%from 54 tests.

About plugin

  • Plugin page: google-pagespeed-...
  • Plugin version: 4.0.8
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-6.0
  • WordPress version: 6.3.1
  • First release: Oct 1, 2013
  • Latest release: Aug 25, 2022
  • Number of updates: 90
  • Update frequency: every 36.1 days
  • Top authors: mattkeys (100%)

Code review

54 tests

User reviews

28 reviews

Install metrics

30,000+ active /617,422 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼8.06ms] Passed 4 tests

This is a short check of server-side resources used by Insights from Google PageSpeed
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0341.21 ▲2.16
Dashboard /wp-admin3.36 ▲0.0246.73 ▼13.52
Posts /wp-admin/edit.php3.41 ▲0.0643.37 ▼2.77
Add New Post /wp-admin/post-new.php5.94 ▲0.0680.83 ▼17.38
Media Library /wp-admin/upload.php3.29 ▲0.0637.53 ▲1.43
Pagespeed Insights /wp-admin/tools.php?page=google-pagespeed-insights3.0622.63

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 152 new files
Database: 6 new tables, 8 new options
New tables
wp_gpi_page_stats
wp_gpi_page_blacklist
wp_gpi_custom_urls
wp_gpi_summary_snapshots
wp_gpi_api_error_logs
wp_gpi_page_reports
New WordPress options
gpagespeedi_options
db_upgraded
theysaidso_admin_options
can_compress_scripts
gpagespeedi_ui_options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Insights from Google PageSpeed
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,802 ▲5614.24 ▼0.381.77 ▲0.1045.24 ▲0.11
Dashboard /wp-admin2,199 ▲195.54 ▼0.1283.25 ▼4.9537.50 ▼5.41
Posts /wp-admin/edit.php2,101 ▲11.96 ▼0.0533.71 ▼5.6336.93 ▲0.13
Add New Post /wp-admin/post-new.php1,529 ▼623.77 ▲5.44667.47 ▲56.7165.80 ▼0.79
Media Library /wp-admin/upload.php1,404 ▲14.19 ▼0.02101.18 ▼5.2144.39 ▼2.21
Pagespeed Insights /wp-admin/tools.php?page=google-pagespeed-insights1,5402.3143.4858.28

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

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
Almost there! Just fix the following items
  • 9× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/google-pagespeed-insights/assets/js/templates/details/audits-filmstrip.php
    • > /wp-content/plugins/google-pagespeed-insights/assets/js/templates/details/audits-criticalrequestchain.php
    • > /wp-content/plugins/google-pagespeed-insights/assets/js/templates/details/audits-table.php
    • > /wp-content/plugins/google-pagespeed-insights/assets/js/templates/summary/scores.php
    • > /wp-content/plugins/google-pagespeed-insights/assets/js/templates/view-snapshot/comment.php
    • > /wp-content/plugins/google-pagespeed-insights/assets/js/templates/details/audits-opportunity.php
    • > /wp-content/plugins/google-pagespeed-insights/assets/js/templates/summary/areas_of_improvement.php
    • > /wp-content/plugins/google-pagespeed-insights/assets/js/templates/details/statistics.php
    • > /wp-content/plugins/google-pagespeed-insights/assets/js/templates/details/audits-diagnostic.php
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/google-pagespeed-insights/google-pagespeed-insights.php:38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/google-pagespeed-insights/templates/parts/nitropack.php:1

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following user-side errors
    • > GET request to /wp-admin/tools.php?page=google-pagespeed-insights
    • > Javascript (severe) in unknown
    /wp-includes/js/wp-auth-check.min.js?ver=6.3.1 1:654 Uncaught TypeError: Cannot read properties of undefined (reading 'hasClass')

Optimizations

Plugin configuration Passed 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
9 plugin tags: seo, search engine optimization, performance, speed, page speed...

google-pagespeed-insights/google-pagespeed-insights.php Passed 13 tests

The main PHP file in "Insights from Google PageSpeed" ver. 4.0.8 adds more information about the plugin and also serves as the entry point for this plugin
76 characters long description:
Get insights from the Google Pagespeed API right in your WordPress dashboard

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
There were no executable files found in this plugin8,513 lines of code in 56 files:
LanguageFilesBlank linesComment linesLines of code
PHP327901914,252
CSS142091991,794
PO File35467501,541
JavaScript41021605
HTML1892250
SVG20071

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.40
Average class complexity78.71
▷ Minimum class complexity1.00
▷ Maximum class complexity154.00
Average method complexity6.05
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods108
▷ Static methods54.63%
▷ Public methods7468.52%
▷ Protected methods10.93%
▷ Private methods3330.56%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
38 PNG files occupy 0.70MB with 0.13MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/bar_background.png0.92KB0.15KB▼ 83.30%
documentation/assets/blueprint-css/plugins/buttons/icons/tick.png0.52KB0.52KB0.00%
documentation/assets/blueprint-css/plugins/buttons/icons/cross.png0.64KB0.72KB0.00%
documentation/assets/blueprint-css/plugins/buttons/icons/key.png0.44KB0.41KB▼ 8.13%
documentation/assets/blueprint-css/plugins/link-icons/icons/email.png0.63KB0.75KB0.00%