Google Analytics Dashboard for WP (GADWP) - Version 5.3.2

Version Description

  • Bug Fixes:
    • fixes for user opt-out feature
  • Enhancements:
    • use gadwp_useroptout shortcode to easily generate opt-out buttons and links, more details
    • adding gadwp_gtag_commands and gadwp_gtag_script_path hooks to allow further gtag (Global Site Tag) code customization
    • adds opt-out and DNT support for Google Tag Manager
Download this release

Release Info

Developer deconf
Plugin Icon 128x128 Google Analytics Dashboard for WP (GADWP)
Version 5.3.2
Comparing to
See all releases

Code changes from version 5.3.1.1 to 5.3.2

admin/settings.php CHANGED
@@ -36,6 +36,8 @@ final class GADWP_Settings {
36
  $options['ga_force_ssl'] = 0;
37
  $options['ga_pagescrolldepth_tracking'] = 0;
38
  $options['tm_pagescrolldepth_tracking'] = 0;
 
 
39
  $options['amp_tracking_analytics'] = 0;
40
  $options['amp_tracking_clientidapi'] = 0;
41
  $options['amp_tracking_tagmanager'] = 0;
@@ -388,7 +390,7 @@ final class GADWP_Settings {
388
  <?php if ( 'universal' == $options['tracking_type'] ) :?>
389
  <?php $tabs = array( 'basic' => __( "Basic Settings", 'google-analytics-dashboard-for-wp' ), 'events' => __( "Events Tracking", 'google-analytics-dashboard-for-wp' ), 'custom' => __( "Custom Definitions", 'google-analytics-dashboard-for-wp' ), 'exclude' => __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ), 'advanced' => __( "Advanced Settings", 'google-analytics-dashboard-for-wp' ), 'integration' => __( "Integration", 'google-analytics-dashboard-for-wp' ) );?>
390
  <?php elseif ( 'tagmanager' == $options['tracking_type'] ) :?>
391
- <?php $tabs = array( 'basic' => __( "Basic Settings", 'google-analytics-dashboard-for-wp' ), 'tmdatalayervars' => __( "DataLayer Variables", 'google-analytics-dashboard-for-wp' ), 'exclude' => __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ), 'tmintegration' => __( "Integration", 'google-analytics-dashboard-for-wp' ) );?>
392
  <?php else :?>
393
  <?php $tabs = array( 'basic' => __( "Basic Settings", 'google-analytics-dashboard-for-wp' ) );?>
394
  <?php endif; ?>
@@ -981,6 +983,37 @@ final class GADWP_Settings {
981
  </tr>
982
  </table>
983
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
984
  <div id="gadwp-tmintegration">
985
  <table class="gadwp-settings-options">
986
  <tr>
@@ -1039,12 +1072,6 @@ final class GADWP_Settings {
1039
  <tr>
1040
  <?php endif; ?>
1041
  <?php endforeach; ?>
1042
-
1043
-
1044
-
1045
-
1046
-
1047
-
1048
  </table>
1049
  </td>
1050
  </tr>
36
  $options['ga_force_ssl'] = 0;
37
  $options['ga_pagescrolldepth_tracking'] = 0;
38
  $options['tm_pagescrolldepth_tracking'] = 0;
39
+ $options['tm_optout'] = 0;
40
+ $options['tm_dnt_optout'] = 0;
41
  $options['amp_tracking_analytics'] = 0;
42
  $options['amp_tracking_clientidapi'] = 0;
43
  $options['amp_tracking_tagmanager'] = 0;
390
  <?php if ( 'universal' == $options['tracking_type'] ) :?>
391
  <?php $tabs = array( 'basic' => __( "Basic Settings", 'google-analytics-dashboard-for-wp' ), 'events' => __( "Events Tracking", 'google-analytics-dashboard-for-wp' ), 'custom' => __( "Custom Definitions", 'google-analytics-dashboard-for-wp' ), 'exclude' => __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ), 'advanced' => __( "Advanced Settings", 'google-analytics-dashboard-for-wp' ), 'integration' => __( "Integration", 'google-analytics-dashboard-for-wp' ) );?>
392
  <?php elseif ( 'tagmanager' == $options['tracking_type'] ) :?>
393
+ <?php $tabs = array( 'basic' => __( "Basic Settings", 'google-analytics-dashboard-for-wp' ), 'tmdatalayervars' => __( "DataLayer Variables", 'google-analytics-dashboard-for-wp' ), 'exclude' => __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ), 'tmadvanced' => __( "Advanced Settings", 'google-analytics-dashboard-for-wp' ), 'tmintegration' => __( "Integration", 'google-analytics-dashboard-for-wp' ) );?>
394
  <?php else :?>
395
  <?php $tabs = array( 'basic' => __( "Basic Settings", 'google-analytics-dashboard-for-wp' ) );?>
396
  <?php endif; ?>
983
  </tr>
984
  </table>
985
  </div>
986
+ <div id="gadwp-tmadvanced">
987
+ <table class="gadwp-settings-options">
988
+ <tr>
989
+ <td colspan="2"><?php echo "<h2>" . __( "Advanced Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
990
+ </tr>
991
+ <tr>
992
+ <td colspan="2" class="gadwp-settings-title">
993
+ <div class="button-primary gadwp-settings-switchoo">
994
+ <input type="checkbox" name="options[tm_optout]" value="1" class="gadwp-settings-switchoo-checkbox" id="tm_optout" <?php checked( $options['tm_optout'], 1 ); ?>>
995
+ <label class="gadwp-settings-switchoo-label" for="tm_optout">
996
+ <div class="gadwp-settings-switchoo-inner"></div>
997
+ <div class="gadwp-settings-switchoo-switch"></div>
998
+ </label>
999
+ </div>
1000
+ <div class="switch-desc"><?php echo " ".__("enable support for user opt-out", 'google-analytics-dashboard-for-wp' );?></div>
1001
+ </td>
1002
+ </tr>
1003
+ <tr>
1004
+ <td colspan="2" class="gadwp-settings-title">
1005
+ <div class="button-primary gadwp-settings-switchoo">
1006
+ <input type="checkbox" name="options[tm_dnt_optout]" value="1" class="gadwp-settings-switchoo-checkbox" id="tm_dnt_optout" <?php checked( $options['tm_dnt_optout'], 1 ); ?>>
1007
+ <label class="gadwp-settings-switchoo-label" for="tm_dnt_optout">
1008
+ <div class="gadwp-settings-switchoo-inner"></div>
1009
+ <div class="gadwp-settings-switchoo-switch"></div>
1010
+ </label>
1011
+ </div>
1012
+ <div class="switch-desc"> <?php _e( 'exclude tracking for users sending Do Not Track header', 'google-analytics-dashboard-for-wp' ); ?></div>
1013
+ </td>
1014
+ </tr>
1015
+ </table>
1016
+ </div>
1017
  <div id="gadwp-tmintegration">
1018
  <table class="gadwp-settings-options">
1019
  <tr>
1072
  <tr>
1073
  <?php endif; ?>
1074
  <?php endforeach; ?>
 
 
 
 
 
 
1075
  </table>
1076
  </td>
1077
  </tr>
config.php CHANGED
@@ -98,6 +98,8 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
98
  'backend_realtime_report',
99
  'ga_optout',
100
  'ga_dnt_optout',
 
 
101
  'ga_with_gtag',
102
  );
103
  foreach ( $numerics as $key ) {
@@ -295,6 +297,8 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
295
  'ga_dnt_optout', //v5.2.3
296
  'ga_with_gtag', //v5.3
297
  'frontend_item_reports',
 
 
298
  );
299
  foreach ( $zeros as $key ) {
300
  if ( ! isset( $this->options[$key] ) ) {
98
  'backend_realtime_report',
99
  'ga_optout',
100
  'ga_dnt_optout',
101
+ 'tm_optout',
102
+ 'tm_dnt_optout',
103
  'ga_with_gtag',
104
  );
105
  foreach ( $numerics as $key ) {
297
  'ga_dnt_optout', //v5.2.3
298
  'ga_with_gtag', //v5.3
299
  'frontend_item_reports',
300
+ 'tm_optout', //v5.3.1.2
301
+ 'tm_dnt_optout', //v5.3.1.2
302
  );
303
  foreach ( $zeros as $key ) {
304
  if ( ! isset( $this->options[$key] ) ) {
front/tracking-analytics.php CHANGED
@@ -475,7 +475,7 @@ if ( ! class_exists( 'GADWP_Tracking_GlobalSiteTag' ) ) {
475
  $this->add( 'event', $fields, $fieldsobject );
476
  }
477
 
478
- do_action( 'gadwp_analytics_commands', $this );
479
  }
480
 
481
  /**
@@ -516,7 +516,7 @@ if ( ! class_exists( 'GADWP_Tracking_GlobalSiteTag' ) ) {
516
  }
517
  }
518
 
519
- $tracking_script_path = apply_filters( 'gadwp_analytics_script_path', 'https://www.googletagmanager.com/gtag/js' );
520
 
521
  if ( $this->gadwp->config->options['ga_optout'] || $this->gadwp->config->options['ga_dnt_optout'] ) {
522
  GADWP_Tools::load_view( 'front/views/analytics-optout-code.php', array( 'uaid' => $this->uaid, 'gaDntOptout' => $this->gadwp->config->options['ga_dnt_optout'], 'gaOptout' => $this->gadwp->config->options['ga_optout'] ) );
475
  $this->add( 'event', $fields, $fieldsobject );
476
  }
477
 
478
+ do_action( 'gadwp_gtag_commands', $this );
479
  }
480
 
481
  /**
516
  }
517
  }
518
 
519
+ $tracking_script_path = apply_filters( 'gadwp_gtag_script_path', 'https://www.googletagmanager.com/gtag/js' );
520
 
521
  if ( $this->gadwp->config->options['ga_optout'] || $this->gadwp->config->options['ga_dnt_optout'] ) {
522
  GADWP_Tools::load_view( 'front/views/analytics-optout-code.php', array( 'uaid' => $this->uaid, 'gaDntOptout' => $this->gadwp->config->options['ga_dnt_optout'], 'gaOptout' => $this->gadwp->config->options['ga_optout'] ) );
front/tracking-tagmanager.php CHANGED
@@ -19,9 +19,15 @@ if ( ! class_exists( 'GADWP_Tracking_TagManager' ) ) {
19
 
20
  private $datalayer;
21
 
 
 
22
  public function __construct() {
23
  $this->gadwp = GADWP();
24
 
 
 
 
 
25
  if ( $this->gadwp->config->options['trackingcode_infooter'] ) {
26
  add_action( 'wp_footer', array( $this, 'output' ), 99 );
27
  } else {
@@ -135,6 +141,10 @@ if ( ! class_exists( 'GADWP_Tracking_TagManager' ) ) {
135
  $vars = "{}";
136
  }
137
 
 
 
 
 
138
  GADWP_Tools::load_view( 'front/views/tagmanager-code.php', array( 'containerid' => $this->gadwp->config->options['web_containerid'], 'vars' => $vars ) );
139
  }
140
 
@@ -155,7 +165,6 @@ if ( ! class_exists( 'GADWP_Tracking_TagManager' ) ) {
155
  * Outputs the Tag Manager code for AMP
156
  */
157
  public function amp_output() {
158
-
159
  $this->build_custom_dimensions();
160
 
161
  $vars = array( 'vars' => $this->datalayer );
@@ -170,8 +179,7 @@ if ( ! class_exists( 'GADWP_Tracking_TagManager' ) ) {
170
 
171
  $json = str_replace( array( '"&#91;', '&#93;"' ), array( '[', ']' ), $json ); // make verticalBoundaries a JavaScript array
172
 
173
- GADWP_Tools::load_view( 'front/views/tagmanager-amp-code.php', array ( 'json' => $json, 'containerid' => $amp_containerid ) );
174
-
175
  }
176
  }
177
  }
19
 
20
  private $datalayer;
21
 
22
+ private $uaid;
23
+
24
  public function __construct() {
25
  $this->gadwp = GADWP();
26
 
27
+ $profile = GADWP_Tools::get_selected_profile( $this->gadwp->config->options['ga_profiles_list'], $this->gadwp->config->options['tableid_jail'] );
28
+
29
+ $this->uaid = esc_html( $profile[2] );
30
+
31
  if ( $this->gadwp->config->options['trackingcode_infooter'] ) {
32
  add_action( 'wp_footer', array( $this, 'output' ), 99 );
33
  } else {
141
  $vars = "{}";
142
  }
143
 
144
+ if ( ( $this->gadwp->config->options['tm_optout'] || $this->gadwp->config->options['tm_dnt_optout'] ) && ! empty( $this->uaid ) ) {
145
+ GADWP_Tools::load_view( 'front/views/analytics-optout-code.php', array( 'uaid' => $this->uaid, 'gaDntOptout' => $this->gadwp->config->options['tm_dnt_optout'], 'gaOptout' => $this->gadwp->config->options['tm_optout'] ) );
146
+ }
147
+
148
  GADWP_Tools::load_view( 'front/views/tagmanager-code.php', array( 'containerid' => $this->gadwp->config->options['web_containerid'], 'vars' => $vars ) );
149
  }
150
 
165
  * Outputs the Tag Manager code for AMP
166
  */
167
  public function amp_output() {
 
168
  $this->build_custom_dimensions();
169
 
170
  $vars = array( 'vars' => $this->datalayer );
179
 
180
  $json = str_replace( array( '"&#91;', '&#93;"' ), array( '[', ']' ), $json ); // make verticalBoundaries a JavaScript array
181
 
182
+ GADWP_Tools::load_view( 'front/views/tagmanager-amp-code.php', array( 'json' => $json, 'containerid' => $amp_containerid ) );
 
183
  }
184
  }
185
  }
front/tracking.php CHANGED
@@ -33,6 +33,17 @@ if ( ! class_exists( 'GADWP_Tracking' ) ) {
33
  GADWP_Tools::doing_it_wrong( __METHOD__, __( "This method is deprecated, read the documentation!", 'google-analytics-dashboard-for-wp' ), '5.0' );
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
36
  public function init() {
37
  // excluded roles
38
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['track_exclude'], true ) || ( $this->gadwp->config->options['superadmin_tracking'] && current_user_can( 'manage_network' ) ) ) {
@@ -61,6 +72,8 @@ if ( ! class_exists( 'GADWP_Tracking' ) ) {
61
  require_once 'tracking-tagmanager.php';
62
  $this->tagmanager = new GADWP_Tracking_TagManager();
63
  }
 
 
64
  }
65
  }
66
  }
33
  GADWP_Tools::doing_it_wrong( __METHOD__, __( "This method is deprecated, read the documentation!", 'google-analytics-dashboard-for-wp' ), '5.0' );
34
  }
35
 
36
+ public static function gadwp_user_optout( $atts, $content = "" ) {
37
+ if ( ! isset( $atts['html_tag'] ) ) {
38
+ $atts['html_tag'] = 'a';
39
+ }
40
+ if ( 'a' == $atts['html_tag'] ) {
41
+ return '<a href="#" class="gadwp_useroptout" onclick="gaOptout()">' . esc_html( $content ) . '</a>';
42
+ } else if ( 'button' == $atts['html_tag'] ) {
43
+ return '<button class="gadwp_useroptout" onclick="gaOptout()">' . esc_html( $content ) . '</button>';
44
+ }
45
+ }
46
+
47
  public function init() {
48
  // excluded roles
49
  if ( GADWP_Tools::check_roles( $this->gadwp->config->options['track_exclude'], true ) || ( $this->gadwp->config->options['superadmin_tracking'] && current_user_can( 'manage_network' ) ) ) {
72
  require_once 'tracking-tagmanager.php';
73
  $this->tagmanager = new GADWP_Tracking_TagManager();
74
  }
75
+
76
+ add_shortcode( 'gadwp_useroptout', array( $this, 'gadwp_user_optout' ) );
77
  }
78
  }
79
  }
front/views/analytics-optout-code.php CHANGED
@@ -8,19 +8,21 @@
8
  */
9
  ?>
10
  <script>
11
- var dnt = false;
12
- var gaProperty = '<?php echo $data['uaid']?>';
13
- var gaDntOptout = '<?php echo $data['gaDntOptout']?>';
14
- var gaOptout = '<?php echo $data['gaOptout']?>';
15
- var disableStr = 'ga-disable-' + gaProperty;
16
- if(gaDntOptout && (window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1")) {
17
- dnt = true;
18
  }
19
- if (dnt || (document.cookie.indexOf(disableStr + '=true') > -1 && gaOptout)) {
20
  window[disableStr] = true;
21
  }
22
  function gaOptout() {
23
- document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
 
 
24
  window[disableStr] = true;
25
  }
26
- </script>
8
  */
9
  ?>
10
  <script>
11
+ var gadwpDnt = false;
12
+ var gadwpProperty = '<?php echo $data['uaid']?>';
13
+ var gadwpDntFollow = <?php echo $data['gaDntOptout'] ? 'true' : 'false'?>;
14
+ var gadwpOptout = <?php echo $data['gaOptout'] ? 'true' : 'false'?>;
15
+ var disableStr = 'ga-disable-' + gadwpProperty;
16
+ if(gadwpDntFollow && (window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1")) {
17
+ gadwpDnt = true;
18
  }
19
+ if (gadwpDnt || (document.cookie.indexOf(disableStr + '=true') > -1 && gadwpOptout)) {
20
  window[disableStr] = true;
21
  }
22
  function gaOptout() {
23
+ var expDate = new Date;
24
+ expDate.setFullYear(expDate.getFullYear( ) + 10);
25
+ document.cookie = disableStr + '=true; expires=' + expDate.toGMTString( ) + '; path=/';
26
  window[disableStr] = true;
27
  }
28
+ </script>
gadwp.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: https://deconf.com
5
  * Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
  * Author: Alin Marcu
7
- * Version: 5.3.1.1
8
  * Author URI: https://deconf.com
9
  * Text Domain: google-analytics-dashboard-for-wp
10
  * Domain Path: /languages
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) )
16
 
17
  // Plugin Version
18
  if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
19
- define( 'GADWP_CURRENT_VERSION', '5.3.1.1' );
20
  }
21
 
22
  if ( ! defined( 'GADWP_ENDPOINT_URL' ) ) {
4
  * Plugin URI: https://deconf.com
5
  * Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
6
  * Author: Alin Marcu
7
+ * Version: 5.3.2
8
  * Author URI: https://deconf.com
9
  * Text Domain: google-analytics-dashboard-for-wp
10
  * Domain Path: /languages
16
 
17
  // Plugin Version
18
  if ( ! defined( 'GADWP_CURRENT_VERSION' ) ) {
19
+ define( 'GADWP_CURRENT_VERSION', '5.3.2' );
20
  }
21
 
22
  if ( ! defined( 'GADWP_ENDPOINT_URL' ) ) {
install/install.php CHANGED
@@ -87,6 +87,8 @@ class GADWP_Install {
87
  $options['with_endpoint'] = 1;
88
  $options['ga_optout'] = 0;
89
  $options['ga_dnt_optout'] = 0;
 
 
90
  $options['ga_with_gtag'] = 0;
91
  } else {
92
  $options = array();
@@ -160,6 +162,8 @@ class GADWP_Install {
160
  $options['with_endpoint'] = 1;
161
  $options['ga_optout'] = 0;
162
  $options['ga_dnt_optout'] = 0;
 
 
163
  $options['ga_with_gtag'] = 0;
164
 
165
  delete_option( 'ga_dash_clientid' );
87
  $options['with_endpoint'] = 1;
88
  $options['ga_optout'] = 0;
89
  $options['ga_dnt_optout'] = 0;
90
+ $options['tm_optout'] = 0;
91
+ $options['tm_dnt_optout'] = 0;
92
  $options['ga_with_gtag'] = 0;
93
  } else {
94
  $options = array();
162
  $options['with_endpoint'] = 1;
163
  $options['ga_optout'] = 0;
164
  $options['ga_dnt_optout'] = 0;
165
+ $options['tm_optout'] = 0;
166
+ $options['tm_dnt_optout'] = 0;
167
  $options['ga_with_gtag'] = 0;
168
 
169
  delete_option( 'ga_dash_clientid' );
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Google Analytics Dashboard for WP (GADWP) ===
2
  Contributors: deconf
3
  Donate link: https://deconf.com/donate/
4
- Tags: analytics,google analytics,google analytics dashboard,google analytics plugin,google analytics widget
5
  Requires at least: 3.5
6
  Tested up to: 4.9.4
7
- Stable tag: 5.3.1.1
8
  Requires PHP: 5.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -173,6 +173,14 @@ Google Analytics Dashboard for WP it's released under the GPLv2, you can use it
173
 
174
  [GADWP v5.3 release notes](https://deconf.com/adding-gtag-js-to-your-site/)
175
 
 
 
 
 
 
 
 
 
176
  = 5.3.1.1 =
177
  * Bug Fixes:
178
  * avoid tracking issues by not clearing the profiles list on automatic token resets
1
  === Google Analytics Dashboard for WP (GADWP) ===
2
  Contributors: deconf
3
  Donate link: https://deconf.com/donate/
4
+ Tags: analytics,google analytics,google analytics dashboard,google analytics plugin,google analytics widget,gtag
5
  Requires at least: 3.5
6
  Tested up to: 4.9.4
7
+ Stable tag: 5.3.2
8
  Requires PHP: 5.2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
173
 
174
  [GADWP v5.3 release notes](https://deconf.com/adding-gtag-js-to-your-site/)
175
 
176
+ = 5.3.2 =
177
+ * Bug Fixes:
178
+ * fixes for user opt-out feature
179
+ * Enhancements:
180
+ * use <em>gadwp_useroptout</em> shortcode to easily generate opt-out buttons and links, [more details](https://deconf.com/google-analytics-gdpr-and-user-data-privacy-compliance)
181
+ * adding <em>gadwp_gtag_commands</em> and <em>gadwp_gtag_script_path</em> hooks to allow further gtag (Global Site Tag) code customization
182
+ * adds opt-out and DNT support for Google Tag Manager
183
+
184
  = 5.3.1.1 =
185
  * Bug Fixes:
186
  * avoid tracking issues by not clearing the profiles list on automatic token resets