83% tracking-code-for-woocommerce

Code Review | Tracking code for Woocommerce

WordPress plugin Tracking code for Woocommerce scored83%from 54 tests.

About plugin

  • Plugin page: tracking-code-for...
  • Plugin version: 1.0.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.3-6.3
  • WordPress version: 6.3.1
  • First release: May 25, 2021
  • Latest release: Oct 2, 2023
  • Number of updates: 13
  • Update frequency: every 66.2 days
  • Top authors: affiliationsoftware (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /1,349 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼5.31ms] Passed 4 tests

A check of server-side resources used by Tracking code for Woocommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0234.49 ▼4.33
Dashboard /wp-admin3.33 ▲0.0345.52 ▼1.81
Posts /wp-admin/edit.php3.38 ▲0.0347.71 ▲1.09
Add New Post /wp-admin/post-new.php5.91 ▲0.0383.61 ▼16.19
Media Library /wp-admin/upload.php3.25 ▲0.0336.01 ▲2.90
Tracking code /wp-admin/admin.php?page=affiliationsoftware-woocommerce3.2331.52

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 9 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-posts
widget_recent-comments
afs_clicks
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
afs_pixels
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Tracking code for Woocommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲7013.17 ▼1.421.65 ▼0.2740.20 ▼4.39
Dashboard /wp-admin2,222 ▲314.84 ▼0.04106.20 ▼2.7741.24 ▲1.82
Posts /wp-admin/edit.php2,104 ▲152.06 ▲0.0142.05 ▲5.8236.85 ▲3.44
Add New Post /wp-admin/post-new.php1,544 ▲2523.18 ▲0.18670.19 ▲53.6859.18 ▲7.88
Media Library /wp-admin/upload.php1,404 ▲134.19 ▼0.05100.90 ▼4.2444.99 ▲2.34
Tracking code /wp-admin/admin.php?page=affiliationsoftware-woocommerce1,0082.1823.6631.60

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
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 75% 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)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
Please fix the following items
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/tracking-code-for-woocommerce/affiliationsoftware-woocommerce.php:43
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/tracking-code-for-woocommerce/inc/admin_page.php:4
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_order_number() on null in wp-content/plugins/tracking-code-for-woocommerce/inc/thankyou_page.php:4
    • > PHP Notice
      Undefined variable: order in wp-content/plugins/tracking-code-for-woocommerce/inc/thankyou_page.php on line 4

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There were no browser issues found

Optimizations

Plugin configuration 90% 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
These attributes need to be fixed:
  • Screenshots: Please add an image for screenshot #1 (Screenshot1 https://www.affiliationsoftware.network/inc/img/integrations/woocommerce-plugin.png)
The official readme.txt is a good inspiration

tracking-code-for-woocommerce/affiliationsoftware-woocommerce.php 85% from 13 tests

The entry point to "Tracking code for Woocommerce" version 1.0.4 is a PHP file that has certain tags in its header comment area
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("tracking-code-for-woocommerce.php" instead of "affiliationsoftware-woocommerce.php")
  • Description: Keep the plugin description shorter than 140 characters (currently 169 characters long)

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
Success! There were no dangerous files found in this plugin267 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP43568234
CSS15018
JavaScript14015

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.70
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions10
▷ Named functions10100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

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
2 PNG files occupy 0.05MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png40.97KB40.97KB0.00%
assets/icon-128x128.png6.92KB3.20KB▼ 53.80%