From 9a23f5c03b108449e7d17e9ff187c2ca1dd94a0e Mon Sep 17 00:00:00 2001 From: Dan0sz <18595395+Dan0sz@users.noreply.github.com> Date: Tue, 21 May 2024 14:45:48 +0200 Subject: [PATCH 1/2] Added: tag to frontend to indicate plugin presence. --- plausible-analytics.php | 2 +- src/Actions.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/plausible-analytics.php b/plausible-analytics.php index bdd8b8a6..e5e2f88b 100644 --- a/plausible-analytics.php +++ b/plausible-analytics.php @@ -18,7 +18,7 @@ } // Define plugin version here for convenience. -define( 'PLAUSIBLE_ANALYTICS_VERSION', '2.0.5' ); +define( 'PLAUSIBLE_ANALYTICS_VERSION', '2.0.8' ); define( 'PLAUSIBLE_ANALYTICS_PLUGIN_FILE', __FILE__ ); define( 'PLAUSIBLE_ANALYTICS_PLUGIN_BASENAME', plugin_basename( PLAUSIBLE_ANALYTICS_PLUGIN_FILE ) ); define( 'PLAUSIBLE_ANALYTICS_PLUGIN_DIR', plugin_dir_path( PLAUSIBLE_ANALYTICS_PLUGIN_FILE ) ); diff --git a/src/Actions.php b/src/Actions.php index 321fbef4..d69f499b 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -18,10 +18,23 @@ class Actions { * @return void */ public function __construct() { + add_action( 'wp_head', [ $this, 'insert_version_meta_tag' ] ); add_action( 'wp_enqueue_scripts', [ $this, 'maybe_register_assets' ] ); add_action( 'admin_bar_menu', [ $this, 'admin_bar_node' ], 100 ); } + /** + * This tag "tells" the Plausible API which version of the plugin is used, to allow tailored error messages, specific to the plugin + * version or whether the plugin is used or not. + * + * @return void + */ + public function insert_version_meta_tag() { + $version = PLAUSIBLE_ANALYTICS_VERSION; + + echo "\n"; + } + /** * Register Assets. * From 7c04530f58674b262d7c9f7487fd2070ba7866ae Mon Sep 17 00:00:00 2001 From: Dan0sz <18595395+Dan0sz@users.noreply.github.com> Date: Tue, 21 May 2024 14:56:34 +0200 Subject: [PATCH 2/2] PHPDoc. --- src/Actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Actions.php b/src/Actions.php index d69f499b..ac9250b9 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -25,7 +25,7 @@ public function __construct() { /** * This tag "tells" the Plausible API which version of the plugin is used, to allow tailored error messages, specific to the plugin - * version or whether the plugin is used or not. + * version. * * @return void */