74% add-google-analytics-to-wp

Code Review | Add Google Analytics to WP

WordPress plugin Add Google Analytics to WP scored 74% from 54 tests.

About plugin

  • Plugin page: add-google-analyt...
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8.1-5.8.2
  • WordPress version: 5.8.1
  • First release: Jan 7, 2022
  • Latest release: Jan 7, 2022
  • Number of updates: 8
  • Update frequency: every 2.4 days
  • Top authors: meetanshi (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 90 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.01MB] [CPU: ▼159.61ms] Passed 4 tests

Server-side resources used by Add Google Analytics to WP
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.76 ▼0.0822.61 ▼2.60
Dashboard /wp-admin3.08 ▲0.0237.29 ▼31.27
Posts /wp-admin/edit.php3.13 ▲0.0340.61 ▼3.85
Add New Post /wp-admin/post-new.php5.44 ▲0.0187.83 ▼600.71
Media Library /wp-admin/upload.php3.03 ▲0.0234.95 ▲2.56

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 20 new files
Database: 1 new table, 1 new option
New tables
wp_m_analtics
New WordPress options
mdetector_datebase_version1.0

Browser metrics Passed 4 tests

This is an overview of browser requirements for Add Google Analytics to WP
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,686 ▲9816.00 ▲0.057.73 ▼1.3980.13 ▼5.89
Dashboard /wp-admin2,950 ▲516.14 ▼0.03120.40 ▼19.15179.98 ▼3.90
Posts /wp-admin/edit.php2,761 ▲213.23 ▼0.0065.79 ▼12.81144.39 ▼8.67
Add New Post /wp-admin/post-new.php2,332 ▼1,26315.77 ▼2.69532.36 ▼311.09181.58 ▼5.23
Media Library /wp-admin/upload.php1,769 ▲205.50 ▲0.03169.70 ▼10.58223.21 ▼13.81

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • Zombie tables were found after uninstall: 1 table
    • wp_m_analtics
  • The uninstall procedure has failed, leaving 1 option in the database
    • mdetector_datebase_version1.0

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
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 7× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-google-analytics-to-wp/admin/ga-code-script.php:26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-google-analytics-to-wp/admin/ga-admin.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-google-analytics-to-wp/includes/meet-google-style.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-google-analytics-to-wp/admin/meetanshi-google-analytics-admin.php:2
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_results() on null in wp-content/plugins/add-google-analytics-to-wp/admin/meet-admin-form.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/add-google-analytics-to-wp/meetanshi-google-analytics.php:25
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/add-google-analytics-to-wp/admin/meet-admin-form.php on line 4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 96% from 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
3 plugin tags: ga plugin, google analytics plugin, meetanshi

add-google-analytics-to-wp/meetanshi-google-analytics.php 92% from 13 tests

The main file in "Add Google Analytics to WP" v. 1.0.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("add-google-analytics-to-wp.php" instead of "meetanshi-google-analytics.php")

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 detected480 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP1364115475
CSS1004
JavaScript1001

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.10
Average class complexity1.67
▷ Minimum class complexity1.00
▷ Maximum class complexity3.00
Average method complexity1.22
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods18
▷ Static methods316.67%
▷ Public methods1372.22%
▷ Protected methods00.00%
▷ Private methods527.78%
Functions11
▷ Named functions11100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There were not PNG files found in your plugin