From ecc82e5efd272607d834e6d8874e63f1c65c3839 Mon Sep 17 00:00:00 2001 From: James Rosado Date: Mon, 20 Jan 2020 10:42:35 -0500 Subject: [PATCH 01/12] adding version number to analytics usage reporting --- src/assets/js/usage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/assets/js/usage.js b/src/assets/js/usage.js index 7055493..a0fcef1 100644 --- a/src/assets/js/usage.js +++ b/src/assets/js/usage.js @@ -87,8 +87,10 @@ BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {}; // Configure license. params.license = self.i18n.license; + params.version = self.i18n.version; params.custom_map = { - dimension7: 'license' + dimension7: 'license', + dimension8: 'version' }; // Configure linker. This will add client id, on click, to all boldgrid.com links. From fed53997da6302dfcf6889ffef2e230452f6a78a Mon Sep 17 00:00:00 2001 From: James Rosado Date: Mon, 20 Jan 2020 10:45:39 -0500 Subject: [PATCH 02/12] added version to usage.php --- src/Library/Usage.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Library/Usage.php b/src/Library/Usage.php index 1fb9356..8cd4f87 100644 --- a/src/Library/Usage.php +++ b/src/Library/Usage.php @@ -108,6 +108,7 @@ public function admin_enqueue_scripts() { 'page' => ! empty ( $_GET['page'] ) ? $_GET['page'] : '', 'ga_id' => $this->gaId, 'license' => json_encode( $licenseData ), + 'version' => BOLDGRID_BACKUP_VERSION, ]; wp_localize_script( $handle, 'BglibUsage', $translation ); From 23e848532bb7c4788749dcc7e50182c09c14be1c Mon Sep 17 00:00:00 2001 From: James Rosado Date: Thu, 23 Jan 2020 09:26:10 -0500 Subject: [PATCH 03/12] adjusted gaId to testing ID --- src/library.global.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/library.global.php b/src/library.global.php index 815b1ea..de2868d 100644 --- a/src/library.global.php +++ b/src/library.global.php @@ -139,5 +139,6 @@ // Google Analytics ID, used by the Usage class. - 'gaId' => 'UA-1501988-42', + // Set to for testing 'UA-114844436-2'. For production set back to 'UA-1501988-42' + 'gaId' => 'UA-114844436-2', ); From acdf6092b968ddbad1ab7342b5e3aecd5460aae5 Mon Sep 17 00:00:00 2001 From: jamesros Date: Tue, 28 Jan 2020 13:33:14 -0500 Subject: [PATCH 04/12] Update usage.js --- src/assets/js/usage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/js/usage.js b/src/assets/js/usage.js index a0fcef1..89355f7 100644 --- a/src/assets/js/usage.js +++ b/src/assets/js/usage.js @@ -87,10 +87,10 @@ BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {}; // Configure license. params.license = self.i18n.license; - params.version = self.i18n.version; + params.version = self.i18n.version; params.custom_map = { dimension7: 'license', - dimension8: 'version' + dimension8: 'version' }; // Configure linker. This will add client id, on click, to all boldgrid.com links. From d1a283fb48770bb889ebf258db6032a105604d87 Mon Sep 17 00:00:00 2001 From: James Rosado Date: Mon, 20 Jan 2020 10:42:35 -0500 Subject: [PATCH 05/12] adding version number to analytics usage reporting --- src/assets/js/usage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/assets/js/usage.js b/src/assets/js/usage.js index 7055493..a0fcef1 100644 --- a/src/assets/js/usage.js +++ b/src/assets/js/usage.js @@ -87,8 +87,10 @@ BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {}; // Configure license. params.license = self.i18n.license; + params.version = self.i18n.version; params.custom_map = { - dimension7: 'license' + dimension7: 'license', + dimension8: 'version' }; // Configure linker. This will add client id, on click, to all boldgrid.com links. From 110e801b52fc2be48c508e5fd7752ff643c28e00 Mon Sep 17 00:00:00 2001 From: James Rosado Date: Mon, 20 Jan 2020 10:45:39 -0500 Subject: [PATCH 06/12] added version to usage.php --- src/Library/Usage.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Library/Usage.php b/src/Library/Usage.php index 1fb9356..8cd4f87 100644 --- a/src/Library/Usage.php +++ b/src/Library/Usage.php @@ -108,6 +108,7 @@ public function admin_enqueue_scripts() { 'page' => ! empty ( $_GET['page'] ) ? $_GET['page'] : '', 'ga_id' => $this->gaId, 'license' => json_encode( $licenseData ), + 'version' => BOLDGRID_BACKUP_VERSION, ]; wp_localize_script( $handle, 'BglibUsage', $translation ); From d57fb2c251028a2f6842661c264b68d495f4826f Mon Sep 17 00:00:00 2001 From: James Rosado Date: Thu, 23 Jan 2020 09:26:10 -0500 Subject: [PATCH 07/12] adjusted gaId to testing ID --- src/library.global.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/library.global.php b/src/library.global.php index 67adafa..d1f578b 100644 --- a/src/library.global.php +++ b/src/library.global.php @@ -140,5 +140,6 @@ // Google Analytics ID, used by the Usage class. - 'gaId' => 'UA-1501988-42', + // Set to for testing 'UA-114844436-2'. For production set back to 'UA-1501988-42' + 'gaId' => 'UA-114844436-2', ); From 9cb62a4d18c50c3fa906dfaf761bbbbf7597653a Mon Sep 17 00:00:00 2001 From: jamesros Date: Tue, 28 Jan 2020 13:33:14 -0500 Subject: [PATCH 08/12] Update usage.js --- src/assets/js/usage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assets/js/usage.js b/src/assets/js/usage.js index a0fcef1..89355f7 100644 --- a/src/assets/js/usage.js +++ b/src/assets/js/usage.js @@ -87,10 +87,10 @@ BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {}; // Configure license. params.license = self.i18n.license; - params.version = self.i18n.version; + params.version = self.i18n.version; params.custom_map = { dimension7: 'license', - dimension8: 'version' + dimension8: 'version' }; // Configure linker. This will add client id, on click, to all boldgrid.com links. From 901c9e484e647cc15ee3de1948d626a71d78555f Mon Sep 17 00:00:00 2001 From: jamesros Date: Mon, 10 Feb 2020 11:15:07 -0500 Subject: [PATCH 09/12] Update library.global.php --- src/library.global.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/library.global.php b/src/library.global.php index de2868d..815b1ea 100644 --- a/src/library.global.php +++ b/src/library.global.php @@ -139,6 +139,5 @@ // Google Analytics ID, used by the Usage class. - // Set to for testing 'UA-114844436-2'. For production set back to 'UA-1501988-42' - 'gaId' => 'UA-114844436-2', + 'gaId' => 'UA-1501988-42', ); From 22f4a2de20887b1b2793f8393d8f86af1b87ef2b Mon Sep 17 00:00:00 2001 From: James Rosado Date: Mon, 10 Feb 2020 14:26:46 -0500 Subject: [PATCH 10/12] adjusted method of obtaining plugin version to be more universal --- src/Library/Usage.php | 21 ++++++++++++++++++++- src/assets/js/usage.js | 8 ++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Library/Usage.php b/src/Library/Usage.php index 8cd4f87..3d6d50a 100644 --- a/src/Library/Usage.php +++ b/src/Library/Usage.php @@ -104,11 +104,30 @@ public function admin_enqueue_scripts() { date( 'Ymd' ) ); + $plugins_data = []; + foreach ( \Boldgrid\Library\Library\Util\Plugin::getFiltered( 'boldgrid' ) as $plugin ) { + $plugins_data[] = [ + 'plugin' => $plugin['TextDomain'], + 'name' => $plugin['Name'], + 'version' => $plugin['Version'], + ]; + } + error_log(serialize(\Boldgrid\Library\Library\Util\Plugin::getFiltered())); + $plugin = ''; + $version = ''; + foreach ($plugins_data as $plugin_data) { + if (false !== strpos( $_GET['page'], $plugin_data['plugin'] ) ) { + $plugin = $plugin_data['name']; + $version = $plugin_data['version']; + } + } + $translation = [ 'page' => ! empty ( $_GET['page'] ) ? $_GET['page'] : '', 'ga_id' => $this->gaId, 'license' => json_encode( $licenseData ), - 'version' => BOLDGRID_BACKUP_VERSION, + 'plugin' => $plugin, + 'version' => $version, ]; wp_localize_script( $handle, 'BglibUsage', $translation ); diff --git a/src/assets/js/usage.js b/src/assets/js/usage.js index 89355f7..785a88e 100644 --- a/src/assets/js/usage.js +++ b/src/assets/js/usage.js @@ -87,10 +87,14 @@ BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {}; // Configure license. params.license = self.i18n.license; - params.version = self.i18n.version; + if ( self.i18n.plugin == 'Total Upkeep' ) { + params.version = self.i18n.version; + } else { + params.version = ''; + } params.custom_map = { dimension7: 'license', - dimension8: 'version' + dimension3: 'version' }; // Configure linker. This will add client id, on click, to all boldgrid.com links. From 2f575f34e45ddfae08b8ad7cc0be95d7bc01bf85 Mon Sep 17 00:00:00 2001 From: James Rosado Date: Mon, 10 Feb 2020 14:38:30 -0500 Subject: [PATCH 11/12] made eslint corrections --- src/assets/js/usage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/js/usage.js b/src/assets/js/usage.js index 785a88e..c1ffab7 100644 --- a/src/assets/js/usage.js +++ b/src/assets/js/usage.js @@ -87,7 +87,7 @@ BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {}; // Configure license. params.license = self.i18n.license; - if ( self.i18n.plugin == 'Total Upkeep' ) { + if ( 'Total Upkeep' === self.i18n.plugin ) { params.version = self.i18n.version; } else { params.version = ''; From a366657d0732179a1bb9cd50d0fb26084cc785ac Mon Sep 17 00:00:00 2001 From: James Rosado Date: Mon, 10 Feb 2020 14:43:55 -0500 Subject: [PATCH 12/12] set gaId and dimension number to production values --- src/assets/js/usage.js | 2 +- src/library.global.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/assets/js/usage.js b/src/assets/js/usage.js index c1ffab7..f383632 100644 --- a/src/assets/js/usage.js +++ b/src/assets/js/usage.js @@ -94,7 +94,7 @@ BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {}; } params.custom_map = { dimension7: 'license', - dimension3: 'version' + dimension8: 'version' }; // Configure linker. This will add client id, on click, to all boldgrid.com links. diff --git a/src/library.global.php b/src/library.global.php index d1f578b..67adafa 100644 --- a/src/library.global.php +++ b/src/library.global.php @@ -140,6 +140,5 @@ // Google Analytics ID, used by the Usage class. - // Set to for testing 'UA-114844436-2'. For production set back to 'UA-1501988-42' - 'gaId' => 'UA-114844436-2', + 'gaId' => 'UA-1501988-42', );