62% first-party-analytics

Code Review | First Party Analytics

WordPress plugin First Party Analytics scored62%from 54 tests.

About plugin

  • Plugin page: first-party-analy...
  • Plugin version: 1.2.18
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Jan 28, 2023
  • Latest release: Sep 10, 2023
  • Number of updates: 13
  • Update frequency: every 17.5 days
  • Top authors: tmmtechnology (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /336 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲4.25MB] [CPU: ▲42.72ms] Passed 4 tests

This is a short check of server-side resources used by First Party Analytics
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /7.71 ▲4.25104.47 ▲54.52
Dashboard /wp-admin7.90 ▲4.5996.59 ▲43.42
Posts /wp-admin/edit.php7.60 ▲4.24103.95 ▲44.61
Add New Post /wp-admin/post-new.php10.16 ▲4.27143.87 ▲28.33
Media Library /wp-admin/upload.php7.47 ▲4.24101.66 ▲61.72
First Party Analytics /wp-admin/admin.php?page=first-party-analytics7.5783.59
Settings /wp-admin/admin.php?page=first-party-analytics-settings7.5186.88
Scheduled Actions /wp-admin/tools.php?page=action-scheduler7.68100.76

Server storage [IO: ▲13.56MB] [DB: ▲0.15MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Please try to fix the following items
  • Illegal file modification found: 1 file (2.72KB) outside of "wp-content/plugins/first-party-analytics/" and "wp-content/uploads/"
    • (new file) wp-content/mu-plugins/first-party-analytics-ajax-optimizer.php
Filesystem: 1,035 new files
Database: 15 new tables, 14 new options
New tables
wp_first_party_analytics_v2_search_words
wp_first_party_analytics_v2_visitor_details
wp_actionscheduler_actions
wp_actionscheduler_groups
wp_actionscheduler_logs
wp_first_party_analytics_v2_special_url_params
wp_first_party_analytics_v2_time_of_day
wp_first_party_analytics_v2_standard_events_meta
wp_actionscheduler_claims
wp_first_party_analytics_v2_standard_events
...
New WordPress options
widget_recent-comments
schema-ActionScheduler_StoreSchema
widget_theysaidso_widget
schema-ActionScheduler_LoggerSchema
first-party-analytics-fields-mapping-last-known-hashes
action_scheduler_hybrid_store_demarkation
widget_recent-posts
first-party-analytics-salt
wp-plugins-core-notifications-first-party-analytics
theysaidso_admin_options
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for First Party Analytics
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,474 ▲68814.01 ▼0.5419.54 ▲17.4935.35 ▼9.52
Dashboard /wp-admin2,824 ▲6475.31 ▼0.36128.70 ▲30.4253.51 ▲13.13
Posts /wp-admin/edit.php2,200 ▲1002.70 ▲0.7443.27 ▲3.3931.71 ▼2.06
Add New Post /wp-admin/post-new.php1,568 ▲4021.40 ▼1.62654.61 ▼31.7733.61 ▼21.96
Media Library /wp-admin/upload.php1,518 ▲1154.91 ▲0.75105.18 ▲5.2944.47 ▼5.33
First Party Analytics /wp-admin/admin.php?page=first-party-analytics7,58711.67263.08129.05
Settings /wp-admin/admin.php?page=first-party-analytics-settings1,5072.5231.3042.16
Scheduled Actions /wp-admin/tools.php?page=action-scheduler1,6422.5233.9033.85

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Zombie tables were found after uninstall: 15 tables
    • wp_first_party_analytics_v2_page_visits_on_finish
    • wp_first_party_analytics_v2_time_of_day
    • wp_actionscheduler_claims
    • wp_actionscheduler_groups
    • wp_first_party_analytics_v2_standard_events_meta
    • wp_first_party_analytics_v2_search_words
    • wp_first_party_analytics_v2_standard_events
    • wp_first_party_analytics_v2_sessions
    • wp_first_party_analytics_v2_link_visits
    • wp_first_party_analytics_v2_visitor_details
    • ...
  • This plugin did not uninstall successfully, leaving 14 options in the database
    • first-party-analytics-fields-mapping-last-known-hashes
    • action_scheduler_hybrid_store_demarkation
    • theysaidso_admin_options
    • first-party-analytics-tracking-cookie-name
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • first-party-analytics-salt
    • can_compress_scripts
    • ...

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
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=first-party-analytics
    • > POST request to /wp-admin/admin-ajax.php
    • > Notice in wp-content/plugins/first-party-analytics/src/class-stop-words.php+58
    Undefined index: default

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 4× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/first-party-analytics/vendor/whichbrowser/parser/bin/update-browser-ids.php
    • > /wp-content/plugins/first-party-analytics/src/standalone-scripts/noscript-tracker.php
    • > /wp-content/plugins/first-party-analytics/vendor/whichbrowser/parser/bin/update-profiles.php
    • > /wp-content/plugins/first-party-analytics/vendor/whichbrowser/parser/bin/update-chrome.php
  • 202× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Pdp\\Host' not found in wp-content/plugins/first-party-analytics/vendor/jeremykendall/php-domain-parser/src/EffectiveTopLevelDomain.php:7
    • > PHP Parse error
      syntax error, unexpected '?', expecting variable (T_VARIABLE) in wp-content/plugins/first-party-analytics/vendor/jeremykendall/php-domain-parser/src/Storage/TopLevelDomainListPsr16Cache.php on line 19
    • > PHP Fatal error
      Uncaught Error: Class 'Action_Scheduler\\Migration\\ActionMigrator' not found in wp-content/plugins/first-party-analytics/vendor/woocommerce/action-scheduler/classes/migration/DryRun_ActionMigrator.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_LogEntry' not found in wp-content/plugins/first-party-analytics/vendor/woocommerce/action-scheduler/classes/ActionScheduler_NullLogEntry.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'First_Party_Analytics\\Representation\\Tables\\Table' not found in wp-content/plugins/first-party-analytics/src/representation/tables/class-searches.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/first-party-analytics/src/templates/admin/screens/settings.php:23
    • > PHP Warning
      count(): Parameter must be an array or an object that implements Countable in wp-content/plugins/first-party-analytics/vendor/whichbrowser/parser/bin/update-indices.php on line 14
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\DeviceModels' not found in wp-content/plugins/first-party-analytics/vendor/whichbrowser/parser/data/models-asha.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'First_Party_Analytics\\Databases\\Database' not found in wp-content/plugins/first-party-analytics/src/database/class-page-visits-on-finish.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Model\\Primitive\ameVersion' not found in wp-content/plugins/first-party-analytics/vendor/whichbrowser/parser/src/Model/Browser.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Tags: There are too many tags (11 tag instead of maximum 10)
The official readme.txt is a good inspiration

first-party-analytics/first-party-analytics.php Passed 13 tests

The primary PHP file in "First Party Analytics" version 1.2.18 is used by WordPress to initiate all plugin functionality
35 characters long description:
A plugin for first-party analytics.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin153,076 lines of code in 901 files:
LanguageFilesBlank linesComment linesLines of code
PHP53211,63318,330107,974
JavaScript1886,0521,29934,578
CSS571121172,509
Markdown2492802,015
TypeScript445833,4382,012
JSON21701,710
Sass20461845
C111825668
LESS71325415
Svelte2310244
XML26165
m418032
C/C++ Header14128
SVG1001

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity16.10
▷ Minimum class complexity1.00
▷ Maximum class complexity489.00
Average method complexity3.76
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces52
Interfaces35
Traits28
Classes342
▷ Abstract classes205.85%
▷ Concrete classes32294.15%
▷ Final classes14845.96%
Methods2,268
▷ Static methods59126.06%
▷ Public methods1,62071.43%
▷ Protected methods1958.60%
▷ Private methods45319.97%
Functions260
▷ Named functions14756.54%
▷ Anonymous functions11343.46%
Constants532
▷ Global constants9918.61%
▷ Class constants43381.39%
▷ Public constants39891.92%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.05MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
media/tracking-pixel-image.png0.07KB0.09KB0.00%
assets/images/filter_icon-0.png6.12KB6.01KB▼ 1.72%
assets/images/filter_icon.png46.02KB16.34KB▼ 64.49%