84% tracking-code-for-google-analytics

Code Review | Tracking Code for Google Analytics

WordPress plugin Tracking Code for Google Analytics scored84%from 54 tests.

About plugin

  • Plugin page: tracking-code-for...
  • Plugin version: 2.0.3
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.0.0
  • WordPress version: 6.3.1
  • First release: Oct 31, 2020
  • Latest release: Jul 11, 2022
  • Number of updates: 12
  • Update frequency: every 51.8 days
  • Top authors: claytoncollie (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /2,639 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 gracefully, with no errors

Server metrics [RAM: ▲0.02MB] [CPU: ▼0.86ms] Passed 4 tests

An overview of server-side resources used by Tracking Code for Google Analytics
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0242.21 ▼0.17
Dashboard /wp-admin49.88 ▲46.539,606,764.05 ▲9,606,711.37
Posts /wp-admin/edit.php3.43 ▲0.0352.07 ▲0.79
Add New Post /wp-admin/post-new.php5.96 ▲0.0399.46 ▼1.37
Media Library /wp-admin/upload.php3.30 ▲0.0238.12 ▼2.70

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

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

Browser metrics Passed 4 tests

A check of browser resources used by Tracking Code for Google Analytics
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.25 ▼0.332.01 ▲0.0443.34 ▲3.14
Dashboard /wp-admin2,195 ▲205.59 ▼0.1284.64 ▼24.3139.68 ▼2.07
Posts /wp-admin/edit.php2,103 ▼02.03 ▲0.0038.38 ▼11.4736.66 ▼2.58
Add New Post /wp-admin/post-new.php1,528 ▼023.26 ▲0.19622.20 ▼108.7767.38 ▲3.71
Media Library /wp-admin/upload.php1,400 ▲34.16 ▼0.01100.56 ▼0.1342.15 ▼5.98

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
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Tracking_Code_For_Google_Analytics\\add_action() in wp-content/plugins/tracking-code-for-google-analytics/inc/admin.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Tracking_Code_For_Google_Analytics\\add_action() in wp-content/plugins/tracking-code-for-google-analytics/inc/public.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Tracking_Code_For_Google_Analytics\\add_action() in wp-content/plugins/tracking-code-for-google-analytics/inc/admin.php:15

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 Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
6 plugin tags: tracking code, google, tracking, tracking snippet, universal analytics...

tracking-code-for-google-analytics/tracking-code-for-google-analytics.php Passed 13 tests

The main file in "Tracking Code for Google Analytics" v. 2.0.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
79 characters long description:
Simple, lightweight solution for inserting your Google Analytics tracking code.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected99 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP4208199

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.28
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
Namespaces1
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%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants00.00%
▷ Class constants9100.00%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG files were detected