78% google-listings-and-ads

Code Review | Google Listings & Ads

WordPress plugin Google Listings & Ads scored78%from 54 tests.

About plugin

  • Plugin page: google-listings-a...
  • Plugin version: 2.5.12
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.9-6.4
  • WordPress version: 6.3.1
  • First release: May 10, 2021
  • Latest release: Nov 22, 2023
  • Number of updates: 133
  • Update frequency: every 7.0 days
  • Top authors: automattic (49.62%)mikkamp (21.05%)eason9487 (13.53%)mppellicer (9.77%)ecgan (6.02%)

Code review

54 tests

User reviews

141 reviews

Install metrics

700,000+ active /15,947,663 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲2.41MB] [CPU: ▼4.67ms] Passed 4 tests

A check of server-side resources used by Google Listings & Ads
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /5.83 ▲2.3638.86 ▼0.95
Dashboard /wp-admin5.85 ▲2.5048.23 ▼13.62
Posts /wp-admin/edit.php5.85 ▲2.5048.55 ▲1.27
Add New Post /wp-admin/post-new.php8.16 ▲2.2889.67 ▼5.39
Media Library /wp-admin/upload.php5.85 ▲2.6235.30 ▲4.53

Server storage [IO: ▲23.23MB] [DB: ▲0.07MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 4,261 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
db_upgraded
widget_recent-posts
gla_delayed_activate
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Google Listings & Ads
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,795 ▲814.57 ▲0.241.64 ▼0.2837.11 ▼8.85
Dashboard /wp-admin2,203 ▲265.63 ▲0.0690.38 ▼3.5842.62 ▼4.42
Posts /wp-admin/edit.php2,106 ▲62.07 ▲0.1139.17 ▲1.9535.42 ▲0.15
Add New Post /wp-admin/post-new.php1,540 ▲1325.27 ▲2.10614.40 ▼88.0364.48 ▲8.26
Media Library /wp-admin/upload.php1,402 ▼14.22 ▲0.0598.92 ▼1.1439.51 ▼3.32

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • gla_delayed_activate
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
Almost there! Just fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/google-listings-and-ads/vendor/googleads/google-ads-php/scripts/print_php_information.php
  • 2439× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/google-listings-and-ads/vendor/google/common-protos/src/Api/FieldInfo.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V14/Errors/MerchantCenterErrorEnum.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Grpc\\BaseStub' not found in wp-content/plugins/google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V14/Services/MerchantCenterLinkServiceGrpcClient.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\Common\\SymmetricKey' not found in wp-content/plugins/google-listings-and-ads/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/BlockCipher.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Automattic\\WooCommerce\\GoogleListingsAndAds\\Vendor\\Google\\Service\\Resource' not found in wp-content/plugins/google-listings-and-ads/vendor/google/apiclient-services/src/ShoppingContent/Resource/Regions.php:31
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V14/Services/ApplyRecommendationOperation/SitelinkExtensionParameters.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Automattic\\WooCommerce\\GoogleListingsAndAds\\Vendor\\Google\\Model' not found in wp-content/plugins/google-listings-and-ads/vendor/google/apiclient-services/src/ShoppingContent/ProductShippingWeight.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Protobuf\\Internal\\Message' not found in wp-content/plugins/google-listings-and-ads/vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/V14/Errors/ConversionAdjustmentUploadErrorEnum.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'Google\\ApiCore\\ServerStreamingCallInterface' not found in wp-content/plugins/google-listings-and-ads/vendor/google/gax/src/Transport/Rest/RestServerStreamingCall.php:49
    • > PHP Fatal error
      Uncaught Error: Class 'Automattic\\WooCommerce\\GoogleListingsAndAds\\Vendor\\Google\\Service' not found in wp-content/plugins/google-listings-and-ads/vendor/google/apiclient-services/src/SiteVerification.php:35

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
4 plugin tags: ads, google, listings, woocommerce

google-listings-and-ads/google-listings-and-ads.php Passed 13 tests

The primary PHP file in "Google Listings & Ads" version 2.5.12 is used by WordPress to initiate all plugin functionality
112 characters long description:
Native integration with Google that allows merchants to easily display their products across Google’s network.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin326,615 lines of code in 4,174 files:
LanguageFilesBlank linesComment linesLines of code
PHP3,95758,616260,571307,413
Markdown883,785010,427
JSON68007,609
SVG1700342
CSS1000279
XSD1180142
XML973139
YAML522092
JavaScript1505574
Python1132344
Protocol Buffers16040
Dockerfile17611
Bourne Shell1203

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
These items need your attention
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 140)
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity5.54
▷ Minimum class complexity1.00
▷ Maximum class complexity679.00
Average method complexity1.64
▷ Minimum method complexity1.00
▷ Maximum method complexity140.00
Code structure
Namespaces469
Interfaces146
Traits74
Classes3,665
▷ Abstract classes2677.29%
▷ Concrete classes3,39892.71%
▷ Final classes1012.97%
Methods26,470
▷ Static methods2,4289.17%
▷ Public methods24,15891.27%
▷ Protected methods1,2734.81%
▷ Private methods1,0393.93%
Functions544
▷ Named functions10419.12%
▷ Anonymous functions44080.88%
Constants3,874
▷ Global constants200.52%
▷ Class constants3,85499.48%
▷ Public constants3,71896.47%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
4 PNG files occupy 0.17MB with 0.08MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
js/build/images/js/src/components/paid-ads/campaign-preview/images/26a3f83547ba2af2f541.shop-sample-logo.png0.71KB0.55KB▼ 23.18%
js/build/images/js/src/get-started-page/benefits-card/ff593be89bcb7ad1ab7e.image.png86.73KB30.24KB▼ 65.13%
js/build/images/js/src/components/free-listings/configure-product-listings/hero/fb15f79da797ad9cca81.google-free-listing.png73.46KB26.19KB▼ 64.34%
js/build/images/js/src/components/paid-ads/campaign-preview/images/093d4a30c2447b174c17.map-background.png11.08KB6.00KB▼ 45.84%