84% thoughtmetric-for-woocommerce

Code Review | ThoughtMetric for WooCommerce

WordPress plugin ThoughtMetric for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: thoughtmetric-for...
  • Plugin version: 1.19.0
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.2.2
  • WordPress version: 6.3.1
  • First release: Mar 30, 2023
  • Latest release: Jul 25, 2023
  • Number of updates: 8
  • Update frequency: every 14.9 days
  • Top authors: msignorella (100%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active /561 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
This plugin's installer ran successfully

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

A check of server-side resources used by ThoughtMetric for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0436.50 ▼7.81
Dashboard /wp-admin3.34 ▲0.0448.51 ▼7.18
Posts /wp-admin/edit.php3.40 ▲0.0448.30 ▼4.14
Add New Post /wp-admin/post-new.php5.92 ▲0.0489.45 ▼0.78
Media Library /wp-admin/upload.php3.27 ▲0.0444.05 ▲9.02
ThoughtMetric /wp-admin/options-general.php?page=thoughtmetric3.2332.66

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 5 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
thoughtmetric_snippet
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for ThoughtMetric for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,803 ▲4214.22 ▼0.262.24 ▲0.4746.98 ▲2.89
Dashboard /wp-admin2,203 ▲265.57 ▼0.0989.36 ▼12.7750.59 ▲7.54
Posts /wp-admin/edit.php2,111 ▲112.13 ▲0.1539.55 ▼0.0145.94 ▲10.93
Add New Post /wp-admin/post-new.php1,536 ▲823.35 ▲0.01670.92 ▼27.8470.09 ▲5.65
Media Library /wp-admin/upload.php1,414 ▲144.19 ▲0.01101.85 ▼0.3156.23 ▲10.90
ThoughtMetric /wp-admin/options-general.php?page=thoughtmetric8292.1722.1745.29

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 7 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • thoughtmetric_snippet

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means 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 take a closer look at the following
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/thoughtmetric-for-woocommerce/inc/thoughtmetric-admin-settings.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
5 plugin tags: attribution, thought metric, marketing analytics, marketing attribution, thoughtmetric

thoughtmetric-for-woocommerce/thoughtmetric-ecommerce.php 85% from 13 tests

The main file in "ThoughtMetric for WooCommerce" v. 1.19.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("thoughtmetric-for-woocommerce.php" instead of "thoughtmetric-ecommerce.php")

Code Analysis Passed 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 plugin286 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP25951206
CSS115080

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.20
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%
Functions13
▷ Named functions13100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
images/tm-logo.png20.71KB10.77KB▼ 48.00%