73% referrer-analytics

Code Review | Referrer Analytics

WordPress plugin Referrer Analytics scored 73% from 54 tests.

About plugin

  • Plugin page: referrer-analytics
  • Plugin version: 2.0.1
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.5.1
  • WordPress version: 6.3.1
  • First release: Jul 13, 2020
  • Latest release: Sep 10, 2020
  • Number of updates: 31
  • Update frequency: every 1.9 days
  • Top authors: bmarshall511 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

70+ active / 983 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.36MB] [CPU: ▲0.76ms] Passed 4 tests

A check of server-side resources used by Referrer Analytics
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.82 ▲0.3534.46 ▼6.71
Dashboard /wp-admin3.68 ▲0.3747.90 ▼5.28
Posts /wp-admin/edit.php3.79 ▲0.4360.23 ▲14.62
Add New Post /wp-admin/post-new.php6.26 ▲0.36105.02 ▲14.36
Media Library /wp-admin/upload.php3.60 ▲0.3636.14 ▲0.67
Referrer Analytics /wp-admin/options-general.php?page=referrer-analytics-settings3.5731.29

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 15 new files
Database: 1 new table, 7 new options
New tables
wp_referrer_analytics
New WordPress options
referrer_analytics_db_version
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
db_upgraded
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Referrer Analytics
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲4713.40 ▼0.781.61 ▼0.6237.02 ▼14.09
Dashboard /wp-admin2,210 ▲244.84 ▼0.10106.58 ▼14.3541.00 ▼4.45
Posts /wp-admin/edit.php2,093 ▲41.97 ▼0.0846.83 ▲10.1235.39 ▲3.55
Add New Post /wp-admin/post-new.php1,545 ▲2618.06 ▼5.07657.55 ▼9.2557.82 ▼0.30
Media Library /wp-admin/upload.php1,395 ▲104.19 ▲0.0096.77 ▼3.3741.67 ▼0.83
Referrer Analytics /wp-admin/options-general.php?page=referrer-analytics-settings1,1722.3834.5946.04

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_referrer_analytics
  • Zombie WordPress options were found after uninstall: 7 options
    • db_upgraded
    • referrer_analytics_db_version
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

SRP 50% 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
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/referrer-analytics/templates/unknowns.php on line 9
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/referrer-analytics/templates/line-chart.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/referrer-analytics/templates/callout.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/referrer-analytics/templates/unknowns.php:24
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/referrer-analytics/templates/popular-list.php:8
    • > PHP Notice
      Undefined variable: log in wp-content/plugins/referrer-analytics/templates/unknowns.php on line 9
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/referrer-analytics/templates/pie-chart.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 90% 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
6 plugin tags: google analytics add-on, statistics, analytics, referrer, stats...

referrer-analytics/referrer-analytics.php 77% from 13 tests

This is the main PHP file of "Referrer Analytics" version 2.0.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Description: Please don't use more than 140 characters for the plugin description (currently 182 characters long)
  • Requires PHP: The required version number must match the one declared in readme.txt ("7.1" instead of "7.2")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Success! There were no dangerous files found in this plugin2,964 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP91952752,799
CSS2310147
JavaScript321418

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity91.00
▷ Minimum class complexity28.00
▷ Maximum class complexity154.00
Average method complexity5.32
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods39
▷ Static methods00.00%
▷ Public methods39100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants4
▷ Global constants4100.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
There are no PNG files in this plugin