84% analytics-insights

Code Review | Analytics Insights for Google Analytics 4 (AIWP)

WordPress plugin Analytics Insights for Google Analytics 4 (AIWP) scored84%from 54 tests.

About plugin

  • Plugin page: analytics-insights
  • Plugin version: 6.0.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-6.4.1
  • WordPress version: 6.3.1
  • First release: Sep 10, 2021
  • Latest release: Dec 2, 2023
  • Number of updates: 150
  • Update frequency: every 5.4 days
  • Top authors: deconf (100%)

Code review

54 tests

User reviews

27 reviews

Install metrics

9,000+ active /105,062 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.77MB] [CPU: ▼1.63ms] Passed 4 tests

Server-side resources used by Analytics Insights for Google Analytics 4 (AIWP)
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.03 ▲0.5748.34 ▲5.29
Dashboard /wp-admin4.18 ▲0.8354.80 ▼14.34
Posts /wp-admin/edit.php4.23 ▲0.8756.75 ▲11.30
Add New Post /wp-admin/post-new.php6.71 ▲0.8290.94 ▼3.48
Media Library /wp-admin/upload.php4.16 ▲0.9340.28 ▲6.00
Tracking Code /wp-admin/admin.php?page=aiwp_tracking_settings4.1638.03
Frontend Settings /wp-admin/admin.php?page=aiwp_frontend_settings4.1643.27
General Settings /wp-admin/admin.php?page=aiwp_settings4.1639.17
Errors & Debug /wp-admin/admin.php?page=aiwp_errors_debugging4.1642.11
Backend Settings /wp-admin/admin.php?page=aiwp_backend_settings4.1638.58

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 84 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-comments
aiwp_options
widget_aiwp-frontwidget-report
widget_theysaidso_widget
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

Checking browser requirements for Analytics Insights for Google Analytics 4 (AIWP)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,979 ▲23216.03 ▲1.675.51 ▲3.8136.40 ▼7.70
Dashboard /wp-admin2,366 ▲1867.35 ▲1.69132.41 ▲38.9443.89 ▲3.18
Posts /wp-admin/edit.php2,203 ▲1034.29 ▲2.2854.65 ▲18.2249.56 ▲13.66
Add New Post /wp-admin/post-new.php1,564 ▲2823.28 ▲0.17685.80 ▲68.7662.18 ▲5.26
Media Library /wp-admin/upload.php1,440 ▲434.21 ▼0.02100.74 ▲0.7041.56 ▼0.12
Tracking Code /wp-admin/admin.php?page=aiwp_tracking_settings3,0208.07235.1169.14
Frontend Settings /wp-admin/admin.php?page=aiwp_frontend_settings1,3597.93189.6149.39
General Settings /wp-admin/admin.php?page=aiwp_settings1,3117.98144.5042.15
Errors & Debug /wp-admin/admin.php?page=aiwp_errors_debugging1,3797.97143.4645.47
Backend Settings /wp-admin/admin.php?page=aiwp_backend_settings1,4857.92143.6548.11

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 7 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_aiwp-frontwidget-report
    • widget_recent-comments

Smoke tests 75% 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 50% 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
  • 10× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_js() in wp-content/plugins/analytics-insights/front/views/tagmanager-amp-code.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_kses() in wp-content/plugins/analytics-insights/front/views/analytics-amp-code.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_kses() in wp-content/plugins/analytics-insights/front/views/tagmanager-code.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_js() in wp-content/plugins/analytics-insights/front/views/analytics-optout-code.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/analytics-insights/front/views/analytics-code.php:12
    • > 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 index: state in wp-content/plugins/analytics-insights/tools/oauth2callback.php on line 3
    • > 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 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_js() in wp-content/plugins/analytics-insights/front/views/optimize-code.php:20
    • > 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 11

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 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
9 plugin tags: google analytics, google analytics 4, wordpress analytics, analytics, ga4...

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

This is the main PHP file of "Analytics Insights for Google Analytics 4 (AIWP)" version 6.0.4, 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 plugin7,817 lines of code in 60 files:
LanguageFilesBlank linesComment linesLines of code
PHP282908235,065
JavaScript183852231,751
CSS14169601,001

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.45
Average class complexity38.25
▷ Minimum class complexity1.00
▷ Maximum class complexity285.00
Average method complexity7.17
▷ Minimum method complexity1.00
▷ Maximum method complexity52.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes24
▷ Abstract classes00.00%
▷ Concrete classes24100.00%
▷ Final classes1250.00%
Methods145
▷ Static methods4329.66%
▷ Public methods11277.24%
▷ Protected methods42.76%
▷ Private methods2920.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.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
common/realtime/images/ui-icons_888888_256x240.png4.27KB4.11KB▼ 3.78%
common/realtime/images/ui-bg_flat_75_ffffff_40x100.png0.17KB0.08KB▼ 51.12%
common/realtime/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
common/realtime/images/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
common/realtime/images/ui-bg_glass_75_e6e6e6_1x400.png0.11KB0.14KB0.00%