93% duracelltomi-google-tag-manager

Code Review | Google Tag Manager for WordPress

WordPress plugin Google Tag Manager for WordPress scored 93% from 54 tests.

About plugin

  • Plugin page: duracelltomi-goog...
  • Plugin version: 1.13.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-5.7.2
  • WordPress version: 5.8.1
  • First release: Sep 23, 2013
  • Latest release: May 20, 2021
  • Number of updates: 253
  • Update frequency: every 11.1 days
  • Top authors: duracelltomi (100%)

Code review

54 tests

User reviews

118 reviews

Install metrics

500,000+ active / 4,448,197 total downloads

Benchmarks

Plugin footprint Passed 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.38MB] [CPU: ▼139.73ms] Passed 4 tests

Analyzing server-side resources used by Google Tag Manager for WordPress
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.02 ▲0.1935.83 ▲0.50
Dashboard /wp-admin3.52 ▲0.4652.55 ▲7.35
Posts /wp-admin/edit.php3.60 ▲0.4948.25 ▲1.97
Add New Post /wp-admin/post-new.php5.87 ▲0.4397.09 ▼565.47
Media Library /wp-admin/upload.php3.45 ▲0.4538.60 ▲4.08
Google Tag Manager /wp-admin/options-general.php?page=gtm4wp-settings3.4234.26

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 136 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Google Tag Manager for WordPress
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,719 ▲12315.87 ▲0.379.24 ▼0.8545.55 ▲0.27
Dashboard /wp-admin2,997 ▲635.98 ▲0.04166.08 ▲8.60110.90 ▼3.66
Posts /wp-admin/edit.php2,767 ▲282.73 ▲0.0274.08 ▲2.3389.38 ▼7.42
Add New Post /wp-admin/post-new.php1,637 ▼4621.40 ▲2.64290.67 ▼95.36112.17 ▲7.86
Media Library /wp-admin/upload.php1,834 ▲245.08 ▼0.00148.36 ▼1.79117.03 ▼3.95
Google Tag Manager /wp-admin/options-general.php?page=gtm4wp-settings3,2222.6873.01122.15

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
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 take a closer look at the following
  • 67× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Constants\\DeviceType' not found in wp-content/plugins/duracelltomi-google-tag-manager/integration/whichbrowser/data/models-wm.php:174
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Model\\Primitive\ameVersion' not found in wp-content/plugins/duracelltomi-google-tag-manager/integration/whichbrowser/src/Model/Engine.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\DeviceModels' not found in wp-content/plugins/duracelltomi-google-tag-manager/integration/whichbrowser/data/models-blackberry.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/duracelltomi-google-tag-manager/integration/vimeo.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\Darwin' not found in wp-content/plugins/duracelltomi-google-tag-manager/integration/whichbrowser/data/os-darwin.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\Applications' not found in wp-content/plugins/duracelltomi-google-tag-manager/integration/whichbrowser/data/regexes/applications-others.php:5
    • > PHP Fatal error
      Trait 'WhichBrowser\\Analyser\\Header\\Useragent\\Os' not found in wp-content/plugins/duracelltomi-google-tag-manager/integration/whichbrowser/src/Analyser/Header/Useragent.php on line 5
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\DeviceModels' not found in wp-content/plugins/duracelltomi-google-tag-manager/integration/whichbrowser/data/models-firefoxos.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Model\\Primitive\\Base' not found in wp-content/plugins/duracelltomi-google-tag-manager/integration/whichbrowser/src/Model/Primitive/NameVersion.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'WhichBrowser\\Data\\BrowserIds' not found in wp-content/plugins/duracelltomi-google-tag-manager/integration/whichbrowser/data/id-android.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • Tags: Please reduce the number of tags, currently 17 tag instead of maximum 10
You can take inspiration from this readme.txt

duracelltomi-google-tag-manager/duracelltomi-google-tag-manager-for-wordpress.php 77% from 13 tests

"Google Tag Manager for WordPress" version 1.13.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("3.4.0" instead of "3.2")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("duracelltomi-google-tag-manager.php" instead of "duracelltomi-google-tag-manager-for-wordpress.php")
  • Domain Path: The domain path folder does not exist ("/languages")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin58,695 lines of code in 131 files:
LanguageFilesBlank linesComment linesLines of code
PHP1184,5971,02756,812
JavaScript123371481,823
CSS112060

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 107)
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity37.79
▷ Minimum class complexity1.00
▷ Maximum class complexity484.00
Average method complexity9.05
▷ Minimum method complexity1.00
▷ Maximum method complexity107.00
Code structure
Namespaces9
Interfaces0
Traits25
Classes36
▷ Abstract classes00.00%
▷ Concrete classes36100.00%
▷ Final classes00.00%
Methods274
▷ Static methods196.93%
▷ Public methods8731.75%
▷ Protected methods00.00%
▷ Private methods18768.25%
Functions89
▷ Named functions7786.52%
▷ Anonymous functions1213.48%
Constants216
▷ Global constants14165.28%
▷ Class constants7534.72%
▷ Public constants75100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/tag_manager-32.png1.28KB1.38KB0.00%
admin/images/tag_manager-64.png0.89KB0.46KB▼ 48.47%