72% analytics-insights

Code Review | Analytics Insights - Google Analytics, AMP Analytics, Stats

WordPress plugin Analytics Insights - Google Analytics, AMP Analytics, Stats scored 72% from 54 tests.

About plugin

  • Plugin page: analytics-insights
  • Plugin version: 5.4.6
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-5.8
  • WordPress version: 5.8.1
  • First release: Sep 10, 2021
  • Latest release: Oct 14, 2021
  • Number of updates: 29
  • Update frequency: every 1.2 days
  • Top authors: deconf (100%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active / 473 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.71MB] [CPU: ▼135.75ms] Passed 4 tests

Server-side resources used by Analytics Insights - Google Analytics, AMP Analytics, Stats
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.24 ▲0.4139.56 ▲5.63
Dashboard /wp-admin3.90 ▲0.8550.04 ▲1.97
Posts /wp-admin/edit.php3.95 ▲0.8451.41 ▲3.87
Add New Post /wp-admin/post-new.php6.18 ▲0.7596.59 ▼550.52
Media Library /wp-admin/upload.php3.88 ▲0.8837.06 ▲1.67
Tracking Code /wp-admin/admin.php?page=aiwp_tracking_settings3.8833.72
Backend Settings /wp-admin/admin.php?page=aiwp_backend_settings3.8835.90
Errors & Debug /wp-admin/admin.php?page=aiwp_errors_debugging3.8835.28
General Settings /wp-admin/admin.php?page=aiwp_settings6.2743.69
Frontend Settings /wp-admin/admin.php?page=aiwp_frontend_settings3.8834.73

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 160 new files
Database: no new tables, 2 new options
New WordPress options
aiwp_options
widget_aiwp-frontwidget-report

Browser metrics Passed 4 tests

Checking browser requirements for Analytics Insights - Google Analytics, AMP Analytics, Stats
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,906 ▲31018.92 ▲3.3714.09 ▲3.1851.22 ▲5.25
Dashboard /wp-admin3,171 ▲2348.04 ▲1.83175.28 ▲27.36110.96 ▲1.37
Posts /wp-admin/edit.php2,872 ▲1335.21 ▲2.5086.07 ▲20.75108.30 ▲20.96
Add New Post /wp-admin/post-new.php1,710 ▲21018.61 ▼0.16388.05 ▼17.72112.68 ▲7.77
Media Library /wp-admin/upload.php1,865 ▲555.04 ▲0.04153.28 ▼0.00111.35 ▼9.71
Tracking Code /wp-admin/admin.php?page=aiwp_tracking_settings4,2018.58254.80142.22
Backend Settings /wp-admin/admin.php?page=aiwp_backend_settings1,9028.26202.50133.68
Errors & Debug /wp-admin/admin.php?page=aiwp_errors_debugging1,7477.76172.48145.17
General Settings /wp-admin/admin.php?page=aiwp_settings1,6517.68161.61126.38
Frontend Settings /wp-admin/admin.php?page=aiwp_frontend_settings1,7337.75181.59157.37

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 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 1 option in the database
    • widget_aiwp-frontwidget-report

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=aiwp_tracking_settings
    • > Notice in wp-content/plugins/analytics-insights/admin/settings.php+340
    Trying to access array offset on value of type null

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
Please fix the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/analytics-insights/front/views/analytics-amp-clientidapi.php
  • 13× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Deconf_Service' not found in wp-content/plugins/analytics-insights/tools/src/Deconf/Service/Analytics.php:29
    • > PHP Warning
      Use of undefined constant AIWP_CURRENT_VERSION - assumed 'AIWP_CURRENT_VERSION' (this will throw an Error in a future version of PHP) in wp-content/plugins/analytics-insights/front/views/tagmanager-code.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/analytics-insights/front/views/analytics-code.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function AIWP() in wp-content/plugins/analytics-insights/admin/views/settings-sidebar.php:3
    • > PHP Notice
      Undefined variable: globalsitetag in wp-content/plugins/analytics-insights/front/views/analytics-code.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_kses() in wp-content/plugins/analytics-insights/front/views/tagmanager-code.php:13
    • > PHP Warning
      Use of undefined constant AIWP_CURRENT_VERSION - assumed 'AIWP_CURRENT_VERSION' (this will throw an Error in a future version of PHP) in wp-content/plugins/analytics-insights/front/views/analytics-code.php on line 12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_js() in wp-content/plugins/analytics-insights/front/views/optimize-code.php:20
    • > PHP Notice
      Undefined variable: globalsitetag in wp-content/plugins/analytics-insights/front/views/analytics-amp-code.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_js() in wp-content/plugins/analytics-insights/front/views/analytics-optout-code.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: Screenshot #5 (Top Pages, Top Referrers, and Top Searches) image not found
You can take inspiration from this readme.txt

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

This is the main PHP file of "Analytics Insights - Google Analytics, AMP Analytics, Stats" version 5.4.6, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 148 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin26,686 lines of code in 122 files:
LanguageFilesBlank linesComment linesLines of code
PHP761,4294,76217,701
PO File143,5385,3186,338
JavaScript183722241,793
CSS1414655854

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity8.29
▷ Minimum class complexity1.00
▷ Maximum class complexity193.00
Average method complexity1.81
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes191
▷ Abstract classes63.14%
▷ Concrete classes18596.86%
▷ Final classes126.49%
Methods1,737
▷ Static methods522.99%
▷ Public methods1,64194.47%
▷ Protected methods241.38%
▷ Private methods724.15%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants57
▷ Global constants58.77%
▷ Class constants5291.23%
▷ Public constants52100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
22 compressed PNG files occupy 0.10MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/analytics-insights.png62.54KB26.37KB▼ 57.84%
admin/images/mcdn.png1.07KB1.15KB0.00%
common/realtime/images/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
common/realtime/images/ui-icons_2e83ff_256x240.png4.27KB4.11KB▼ 3.78%
common/realtime/images/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%