74% add-google-analytics-to-wp

Code Review | Add Google Analytics to WP

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

About plugin

  • Plugin page: add-google-analyt...
  • Plugin version: 1.0.1
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8.1-6.1
  • WordPress version: 6.3.1
  • First release: Jan 7, 2022
  • Latest release: Nov 9, 2022
  • Number of updates: 12
  • Update frequency: every 26.8 days
  • Top authors: meetanshi (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /768 total downloads


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
Install script ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼8.69ms] Passed 4 tests

A check of server-side resources used by Add Google Analytics to WP
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.40 ▼0.0623.91 ▼13.84
Dashboard /wp-admin3.33 ▲0.0244.82 ▼0.98
Posts /wp-admin/edit.php3.38 ▲0.0246.83 ▲3.18
Add New Post /wp-admin/post-new.php5.91 ▲0.0279.66 ▼21.16
Media Library /wp-admin/upload.php3.25 ▲0.0235.82 ▲1.21

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 20 new files
Database: 1 new table, 7 new options
New tables
New WordPress options

Browser metrics Passed 4 tests

An overview of browser requirements for Add Google Analytics to WP
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,830 ▲6914.68 ▲0.311.79 ▲0.1242.87 ▲5.03
Dashboard /wp-admin2,214 ▲405.58 ▲0.0386.31 ▼2.7137.02 ▼4.43
Posts /wp-admin/edit.php2,116 ▲132.02 ▲0.0336.43 ▼4.1534.31 ▼0.68
Add New Post /wp-admin/post-new.php1,547 ▲1618.12 ▼5.00619.13 ▲19.8386.63 ▲23.42
Media Library /wp-admin/upload.php1,416 ▲134.19 ▲0.0397.84 ▼4.2242.61 ▼2.38

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_m_analtics
  • Zombie WordPress options detected upon uninstall: 7 options
    • can_compress_scripts
    • theysaidso_admin_options
    • mdetector_datebase_version1.0
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, 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
Almost there! Just fix the following items
  • 7× PHP files trigger server errors when accessed directly:
    • > 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 plugin_dir_path() in wp-content/plugins/add-google-analytics-to-wp/meetanshi-google-analytics.php:25
    • > 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 undefined function add_action() in wp-content/plugins/add-google-analytics-to-wp/admin/ga-admin.php:3
    • > 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
    • > 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 a member function get_results() on null in wp-content/plugins/add-google-analytics-to-wp/admin/meet-admin-form.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected


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

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

The principal PHP file in "Add Google Analytics to WP" v. 1.0.1 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to 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 | This is a short overview of programming languages used in this plugin, detecting executable files
No dangerous file extensions were detected480 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic 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
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
▷ Static methods316.67%
▷ Public methods1372.22%
▷ Protected methods00.00%
▷ Private methods527.78%
▷ Named functions11100.00%
▷ Anonymous functions00.00%
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
No PNG files were detected