10% better-analytics

Code Review | Better Google Analytics

WordPress plugin Better Google Analytics scored10%from 54 tests.

About plugin

  • Plugin page: better-analytics
  • Plugin version: 1.2.7
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-5.9.9
  • WordPress version: 6.3.1
  • First release: May 29, 2015
  • Latest release: Feb 24, 2022
  • Number of updates: 71
  • Update frequency: every 34.7 days
  • Top authors: digitalpoint (100%)

Code review

54 tests

User reviews

34 reviews

Install metrics

5,000+ active /202,428 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
These installer errors require your attention
  • The plugin did not install without errors
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/Base/Admin.php+57
    Trying to access array offset on value of type bool

Server metrics [RAM: ▲0.42MB] [CPU: ▼2.21ms] Passed 4 tests

An overview of server-side resources used by Better Google Analytics
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.77 ▲0.3145.83 ▼1.16
Dashboard /wp-admin3.77 ▲0.4652.66 ▲1.45
Posts /wp-admin/edit.php3.81 ▲0.4658.24 ▲5.64
Add New Post /wp-admin/post-new.php6.41 ▲0.5289.83 ▼12.94
Media Library /wp-admin/upload.php3.67 ▲0.4440.12 ▲3.83
A/B Testing /wp-admin/admin.php?page=better-analytics_experiments3.8538.98
Issue Monitor /wp-admin/admin.php?page=better-analytics_monitor3.8537.00
Test Setup /wp-admin/tools.php?page=better-analytics_test3.9943.72
Goals /wp-admin/admin.php?page=better-analytics_goals3.8537.72
Charts /wp-admin/admin.php?page=better-analytics_areacharts3.8542.18
Reports /wp-admin/admin.php?page=better-analytics_heatmaps3.8540.54
Settings /wp-admin/options-general.php?page=better-analytics4.0738.01
Events /wp-admin/admin.php?page=better-analytics_events3.8540.74
OAuth2 Endpoint /wp-admin/tools.php?page=better-analytics_auth3.8839.12

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 49 new files
Database: no new tables, 9 new options
New WordPress options
widget_better-analytics_stats_widget
better_analytics
widget_better-analytics_popular_widget
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Better Google Analytics
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,059 ▲29815.92 ▲1.5425.16 ▲23.4943.15 ▼2.01
Dashboard /wp-admin2,361 ▲1556.94 ▲1.96128.31 ▲23.7939.39 ▼5.64
Posts /wp-admin/edit.php2,186 ▲862.19 ▲0.2240.33 ▼0.6438.75 ▼1.28
Add New Post /wp-admin/post-new.php1,596 ▲5117.71 ▼5.38603.23 ▼87.5458.17 ▼0.10
Media Library /wp-admin/upload.php1,483 ▲834.22 ▲0.0199.98 ▲0.9542.46 ▼0.04
A/B Testing /wp-admin/admin.php?page=better-analytics_experiments8452.0423.4625.79
Issue Monitor /wp-admin/admin.php?page=better-analytics_monitor8452.0725.2425.01
Test Setup /wp-admin/tools.php?page=better-analytics_test1,3502.2025.9340.21
Goals /wp-admin/admin.php?page=better-analytics_goals8542.2029.5324.06
Charts /wp-admin/admin.php?page=better-analytics_areacharts8442.0424.7625.21
Reports /wp-admin/admin.php?page=better-analytics_heatmaps8442.1924.3323.62
Settings /wp-admin/options-general.php?page=better-analytics2,4322.6257.8242.74
Events /wp-admin/admin.php?page=better-analytics_events8442.1924.1126.85
OAuth2 Endpoint /wp-admin/tools.php?page=better-analytics_auth5033.0578.8688.83

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Zombie WordPress options were found after uninstall: 8 options
    • widget_recent-comments
    • widget_better-analytics_popular_widget
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_better-analytics_stats_widget
    • can_compress_scripts
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Smoke test failed, please fix the following
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=better-analytics_auth
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/Helper/Reporting.php+110
    Undefined index: api
  • 16 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=better-analytics_auth
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/Helper/Reporting.php+110
    Trying to access array offset on value of type null
    • > GET request to /wp-admin/tools.php?page=better-analytics_test
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/test.php+369
    Undefined index: siteSearchSetup
    • > GET request to /wp-admin/tools.php?page=better-analytics_test
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/test.php+382
    Undefined index: ecommerceTracking
    • > GET request to /wp-admin/tools.php?page=better-analytics_test
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/test.php+396
    Undefined index: enhancedEcommerceTracking
    • > GET request to /wp-admin/tools.php?page=better-analytics_test
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/test.php+414
    Undefined index: industryVertical
  • 12 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=better-analytics
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/config.php+628
    Undefined index: dimension
    • > GET request to /wp-admin/options-general.php?page=better-analytics
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/config.php+267
    Undefined index: user_engagement
    • > GET request to /wp-admin/options-general.php?page=better-analytics
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/config.php+314
    Undefined index: page_scroll
    • > GET request to /wp-admin/options-general.php?page=better-analytics
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/config.php+320
    Undefined index: time_on_page
    • > GET request to /wp-admin/options-general.php?page=better-analytics
    • > Notice in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/config.php+1160
    Undefined index: extra_js

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/better-analytics/js/loader.php
    • > /wp-content/plugins/better-analytics/better-analytics.php
  • 20× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WP_List_Table' not found in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/Formatting/ExperimentTable.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_script() in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/goals.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'DigitalPointBetterAnalytics_Helper_Reporting_Advanced' not found in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/Helper/Reporting.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'DigitalPointBetterAnalytics_Helper_Analytics_Advanced' not found in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/Helper/Analytics.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_script() in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/reports/heatmaps.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/Widget/Stats.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_script() in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/config_network.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_script() in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/experiments.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/Widget/PopularPosts.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_style() in wp-content/plugins/better-analytics/library/DigitalPointBetterAnalytics/ViewAdmin/test.php:2

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 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Tags: Please delete some tags, you are using 39 tag instead of maximum 10
Please take inspiration from this readme.txt

better-analytics/better-analytics.php 92% from 13 tests

The main PHP file in "Better Google Analytics" ver. 1.2.7 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Description: The description should be shorter than 140 characters (currently 340 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
No dangerous file extensions were detected8,657 lines of code in 45 files:
LanguageFilesBlank linesComment linesLines of code
PHP361,8112368,270
CSS32510243
Markdown16059
JSON10044
JavaScript40141

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity28.58
▷ Minimum class complexity1.00
▷ Maximum class complexity119.00
Average method complexity3.77
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes24
▷ Abstract classes625.00%
▷ Concrete classes1875.00%
▷ Final classes00.00%
Methods256
▷ Static methods6123.83%
▷ Public methods16664.84%
▷ Protected methods8733.98%
▷ Private methods31.17%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.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
2 compressed PNG files occupy 0.00MB
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/chosen/chosen-sprite.png0.53KB0.88KB0.00%
assets/chosen/chosen-sprite@2x.png0.72KB0.83KB0.00%