78% google-analytics-for-wordpress

Code Review | MonsterInsights - Google Analytics Dashboard for WordPress (Website Stats Made Easy)

WordPress plugin MonsterInsights - Google Analytics Dashboard for WordPress (Website Stats Made Easy) scored 78% from 54 tests.

About plugin

  • Plugin page: google-analytics-...
  • Plugin version: 8.4.0
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8.0-5.9
  • WordPress version: 5.9.2
  • First release: Sep 14, 2007
  • Latest release: Feb 28, 2022
  • Number of updates: 484
  • Update frequency: every 10.9 days
  • Top authors: joostdevalk (44.83%)chriscct7 (44.63%)gripgrip (5.17%)omarreiss (2.89%)smub (1.65%)

Code review

54 tests

User reviews

2503 reviews

Install metrics

3,000,000+ active / 114,546,949 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
Install script ran successfully

Server metrics [RAM: ▲2.59MB] [CPU: ▼292.53ms] Passed 4 tests

Server-side resources used by MonsterInsights - Google Analytics Dashboard for WordPress (Website Stats Made Easy)
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.64 ▲1.1263.41 ▼11.98
Dashboard /wp-admin6.50 ▲3.0956.10 ▲21.27
Posts /wp-admin/edit.php6.72 ▲3.0757.14 ▲18.00
Add New Post /wp-admin/post-new.php10.04 ▲3.07116.14 ▼1,194.39
Media Library /wp-admin/upload.php6.43 ▲3.1444.72 ▲18.25
Reports /wp-admin/admin.php?page=monsterinsights_reports6.3645.16
Settings /wp-admin/admin.php?page=monsterinsights_settings6.3647.78
Welcome to MonsterInsights /wp-admin/index.php?page=monsterinsights-getting-started6.3643.52

Server storage [IO: ▲10.21MB] [DB: ▲0.01MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 340 new files
Database: no new tables, 6 new options
New WordPress options
monsterinsights_settings
widget_monsterinsights-popular-posts-widget
monsterinsights_current_version
monsterinsights_review
monsterinsights_db_version
monsterinsights_usage_tracking_config

Browser metrics Passed 4 tests

An overview of browser requirements for MonsterInsights - Google Analytics Dashboard for WordPress (Website Stats Made Easy)
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,061 ▲30719.57 ▲4.2726.31 ▲20.102.83 ▲0.54
Dashboard /wp-admin3,112 ▲2517.65 ▲1.42177.22 ▲36.92236.84 ▲71.79
Posts /wp-admin/edit.php2,833 ▲1394.33 ▲1.0987.35 ▲23.40217.09 ▲71.10
Add New Post /wp-admin/post-new.php2,299 ▲60922.93 ▲1.59503.76 ▲49.43215.90 ▲32.02
Media Library /wp-admin/upload.php1,841 ▲1467.04 ▲1.45156.14 ▲5.85208.71 ▼28.97
Reports /wp-admin/admin.php?page=monsterinsights_reports1,5796.50205.34330.18
Settings /wp-admin/admin.php?page=monsterinsights_settings1,6005.93160.84301.93
Welcome to MonsterInsights /wp-admin/index.php?page=monsterinsights-getting-started1,5325.11125.72196.75

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • The uninstall procedure has failed, leaving 3 options in the database
    • widget_monsterinsights-popular-posts-widget
    • monsterinsights_settings
    • monsterinsights_current_version

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
  • 7× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/google-analytics-for-wordpress/includes/gutenberg/headline-tool/phpinsight/examples/demo.php
    • > /wp-content/plugins/google-analytics-for-wordpress/includes/gutenberg/headline-tool/phpinsight/lib/PHPInsight/data/data.neu.php
    • > /wp-content/plugins/google-analytics-for-wordpress/includes/gutenberg/headline-tool/phpinsight/lib/PHPInsight/data/data.neg.php
    • > /wp-content/plugins/google-analytics-for-wordpress/includes/gutenberg/headline-tool/phpinsight/lib/PHPInsight/data/data.pos.php
    • > /wp-content/plugins/google-analytics-for-wordpress/includes/gutenberg/headline-tool/phpinsight/lib/PHPInsight/data/data.prefix.php
    • > /wp-content/plugins/google-analytics-for-wordpress/includes/emails/templates/body-default-plain.php
    • > /wp-content/plugins/google-analytics-for-wordpress/includes/gutenberg/headline-tool/phpinsight/lib/PHPInsight/data/data.ign.php
  • 53× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'MonsterInsights_Notification_Event' not found in wp-content/plugins/google-analytics-for-wordpress/includes/admin/notifications/notification-upgrade-for-form-conversion.php:9
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-upgrader.php): failed to open stream: No such file or directory in wp-content/plugins/google-analytics-for-wordpress/includes/admin/licensing/plugin-upgrader.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'MonsterInsights_Notification_Event' not found in wp-content/plugins/google-analytics-for-wordpress/includes/admin/notifications/notification-upgrade-for-search-console.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'MonsterInsights_Notification_Event' not found in wp-content/plugins/google-analytics-for-wordpress/includes/admin/notifications/notification-upgrade-for-email-summaries.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'PHPInsight_Autoloader' not found in wp-content/plugins/google-analytics-for-wordpress/includes/gutenberg/headline-tool/phpinsight/lib/bootstrap.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/google-analytics-for-wordpress/lite/includes/admin/helpers.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'MonsterInsights_Notification_Event' not found in wp-content/plugins/google-analytics-for-wordpress/includes/admin/notifications/notification-traffic-dropping.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/google-analytics-for-wordpress/includes/admin/licensing/autoupdate.php:72
    • > PHP Fatal error
      Uncaught Error: Class 'MonsterInsights_Notification_Event' not found in wp-content/plugins/google-analytics-for-wordpress/includes/admin/notifications/notification-bounce-rate.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'MonsterInsights_Notification_Event' not found in wp-content/plugins/google-analytics-for-wordpress/includes/admin/notifications/notification-upgrade-eu-traffic.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Tags: You are using too many tags: 19 tag instead of maximum 10
Please take inspiration from this readme.txt

google-analytics-for-wordpress/googleanalytics.php 92% from 13 tests

The main PHP script in "MonsterInsights - Google Analytics Dashboard for WordPress (Website Stats Made Easy)" version 8.4.0 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("google-analytics-for-wordpress.php" instead of "googleanalytics.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin29,183 lines of code in 209 files:
LanguageFilesBlank linesComment linesLines of code
PHP1234,94619,62627,262
JavaScript191811601,446
CSS23529319
SVG41360117
JSON11020
Markdown28019

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity24.25
▷ Minimum class complexity1.00
▷ Maximum class complexity207.00
Average method complexity4.32
▷ Minimum method complexity1.00
▷ Maximum method complexity42.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes81
▷ Abstract classes00.00%
▷ Concrete classes81100.00%
▷ Final classes3745.68%
Methods567
▷ Static methods183.17%
▷ Public methods52392.24%
▷ Protected methods152.65%
▷ Private methods295.11%
Functions167
▷ Named functions16397.60%
▷ Anonymous functions42.40%
Constants24
▷ Global constants2291.67%
▷ Class constants28.33%
▷ Public constants2100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
67 PNG files occupy 1.10MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lite/assets/vue/img/bg-forms@2x.png8.82KB8.82KB0.03%
assets/images/down.png1.02KB0.21KB▼ 79.50%
lite/assets/vue/img/memberpress.png4.31KB4.39KB0.00%
lite/assets/vue/img/about-icon-guide.png5.98KB6.67KB0.00%
lite/assets/vue/img/icon-seedprod.png1.66KB1.61KB▼ 2.94%