Google Analytics Dashboard for WP (GADWP) - Version 5.3.5

Version Description

  • Bug Fixes:
    • Re-tagging release to fix a deployment issue.
Download this release

Release Info

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

Code changes from version 5.3.3 to 5.3.5

admin/settings.php CHANGED
@@ -60,6 +60,9 @@ final class GADWP_Settings {
60
if ( empty( $new_options['access_back'] ) ) {
61
$new_options['access_back'][] = 'administrator';
62
}
63
} elseif ( 'frontend' == $who ) {
64
$options['frontend_item_reports'] = 0;
65
if ( empty( $new_options['access_front'] ) ) {
@@ -67,6 +70,7 @@ final class GADWP_Settings {
67
}
68
} elseif ( 'general' == $who ) {
69
$options['user_api'] = 0;
70
if ( ! is_multisite() ) {
71
$options['automatic_updates_minorversion'] = 0;
72
}
@@ -76,7 +80,13 @@ final class GADWP_Settings {
76
$options['superadmin_tracking'] = 0;
77
$options['automatic_updates_minorversion'] = 0;
78
$network_settings = true;
79
}
80
$options = array_merge( $options, $new_options );
81
$gadwp->config->options = $options;
82
$gadwp->config->set_plugin_options( $network_settings );
@@ -342,6 +352,28 @@ final class GADWP_Settings {
342
<hr>
343
</td>
344
</tr>
345
<tr>
346
<td colspan="2" class="submit">
347
<input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" />
@@ -1477,6 +1509,26 @@ final class GADWP_Settings {
1477
</td>
1478
</tr>
1479
<?php endif; ?>
1480
<tr>
1481
<td colspan="2" class="submit">
1482
<input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" />
@@ -1793,6 +1845,11 @@ final class GADWP_Settings {
1793
<div class="switch-desc"><?php echo " ".__( "automatic updates for minor versions (security and maintenance releases only)", 'google-analytics-dashboard-for-wp' );?></div>
1794
</td>
1795
</tr>
1796
<tr>
1797
<td colspan="2">
1798
<hr><?php echo "<h2>" . __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
@@ -1814,6 +1871,26 @@ final class GADWP_Settings {
1814
<hr>
1815
</td>
1816
</tr>
1817
<tr>
1818
<td colspan="2" class="submit">
1819
<input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" />
60
if ( empty( $new_options['access_back'] ) ) {
61
$new_options['access_back'][] = 'administrator';
62
}
63
+ if ( ! is_multisite() ) {
64
+ $options['hide_am_notices'] = 0;
65
+ }
66
} elseif ( 'frontend' == $who ) {
67
$options['frontend_item_reports'] = 0;
68
if ( empty( $new_options['access_front'] ) ) {
70
}
71
} elseif ( 'general' == $who ) {
72
$options['user_api'] = 0;
73
+ $options['usage_tracking'] = 0;
74
if ( ! is_multisite() ) {
75
$options['automatic_updates_minorversion'] = 0;
76
}
80
$options['superadmin_tracking'] = 0;
81
$options['automatic_updates_minorversion'] = 0;
82
$network_settings = true;
83
+ $options['network_hide_am_notices'] = 0;
84
}
85
+ if ( ! $network_settings && 'general' == $who ) {
86
+ $usage_tracking = isset( $_POST['usage_tracking'] ) ? (int) $_POST['usage_tracking'] : 0;
87
+ do_action( 'exactmetrics_settings_usage_tracking', $usage_tracking );
88
+ }
89
+
90
$options = array_merge( $options, $new_options );
91
$gadwp->config->options = $options;
92
$gadwp->config->set_plugin_options( $network_settings );
352
<hr>
353
</td>
354
</tr>
355
+ <?php if ( ! is_multisite()) :?>
356
+ <tr>
357
+ <td colspan="2"><?php echo "<h2>" . __( "Hide Announcements", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
358
+ </tr>
359
+ <tr>
360
+ <td colspan="2" class="gadwp-settings-title">
361
+ <div class="button-primary gadwp-settings-switchoo">
362
+ <input type="checkbox" name="options[hide_am_notices]" value="1" class="gadwp-settings-switchoo-checkbox" id="hide_am_notices" <?php checked( $options['hide_am_notices'], 1 ); ?>>
363
+ <label class="gadwp-settings-switchoo-label" for="hide_am_notices">
364
+ <div class="gadwp-settings-switchoo-inner"></div>
365
+ <div class="gadwp-settings-switchoo-switch"></div>
366
+ </label>
367
+ </div>
368
+ <div class="switch-desc"><?php echo esc_html__( 'Hides plugin announcements and update details. This includes critical notices we use to inform about deprecations and important required configuration changes.' ); ?></div>
369
+ </td>
370
+ </tr>
371
+ <tr>
372
+ <td colspan="2">
373
+ <hr>
374
+ </td>
375
+ </tr>
376
+ <?php endif; ?>
377
<tr>
378
<td colspan="2" class="submit">
379
<input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" />
1509
</td>
1510
</tr>
1511
<?php endif; ?>
1512
+ <tr>
1513
+ <td colspan="2"><?php echo "<h2>" . __( "Usage Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1514
+ </tr>
1515
+ <tr>
1516
+ <td colspan="2" class="gadwp-settings-title">
1517
+ <div class="button-primary gadwp-settings-switchoo">
1518
+ <input type="checkbox" name="options[usage_tracking]" value="1" class="gadwp-settings-switchoo-checkbox" id="usage_tracking" <?php checked( $options['usage_tracking'], 1 ); ?>>
1519
+ <label class="gadwp-settings-switchoo-label" for="usage_tracking">
1520
+ <div class="gadwp-settings-switchoo-inner"></div>
1521
+ <div class="gadwp-settings-switchoo-switch"></div>
1522
+ </label>
1523
+ </div>
1524
+ <div class="switch-desc"><?php echo " ". sprintf( esc_html__( 'ExactMetrics would like to %1$scollect some information%2$s to better understand how our users use our plugin to better prioritize features and bugfixes.', 'google-analytics-dashboard-for-wp' ), '<a href="https://exactmetrics.com/usage-tracking/?utm_source=wpdashboard&utm_campaign=usagetracking&utm_medium=plugin" target="_blank">', '</a>' ); ; ?></div>
1525
+ </td>
1526
+ </tr>
1527
+ <tr>
1528
+ <td colspan="2">
1529
+ <hr>
1530
+ </td>
1531
+ </tr>
1532
<tr>
1533
<td colspan="2" class="submit">
1534
<input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" />
1845
<div class="switch-desc"><?php echo " ".__( "automatic updates for minor versions (security and maintenance releases only)", 'google-analytics-dashboard-for-wp' );?></div>
1846
</td>
1847
</tr>
1848
+ <tr>
1849
+ <td colspan="2">
1850
+ <hr>
1851
+ </td>
1852
+ </tr>
1853
<tr>
1854
<td colspan="2">
1855
<hr><?php echo "<h2>" . __( "Exclude Tracking", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1871
<hr>
1872
</td>
1873
</tr>
1874
+ <tr>
1875
+ <td colspan="2"><?php echo "<h2>" . __( "Hide Announcements", 'google-analytics-dashboard-for-wp' ) . "</h2>"; ?></td>
1876
+ </tr>
1877
+ <tr>
1878
+ <td colspan="2" class="gadwp-settings-title">
1879
+ <div class="button-primary gadwp-settings-switchoo">
1880
+ <input type="checkbox" name="options[network_hide_am_notices]" value="1" class="gadwp-settings-switchoo-checkbox" id="network_hide_am_notices" <?php checked( $options['network_hide_am_notices'], 1 ); ?>>
1881
+ <label class="gadwp-settings-switchoo-label" for="network_hide_am_notices">
1882
+ <div class="gadwp-settings-switchoo-inner"></div>
1883
+ <div class="gadwp-settings-switchoo-switch"></div>
1884
+ </label>
1885
+ </div>
1886
+ <div class="switch-desc"><?php echo esc_html__( 'Hides plugin announcements and update details. This includes critical notices we use to inform about deprecations and important required configuration changes.' ); ?></div>
1887
+ </td>
1888
+ </tr>
1889
+ <tr>
1890
+ <td colspan="2">
1891
+ <hr>
1892
+ </td>
1893
+ </tr>
1894
<tr>
1895
<td colspan="2" class="submit">
1896
<input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp' ) ?>" />
admin/setup.php CHANGED
@@ -28,8 +28,8 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
28
add_action( 'network_admin_menu', array( $this, 'network_menu' ) );
29
// Settings link
30
add_filter( "plugin_action_links_" . plugin_basename( GADWP_DIR . 'gadwp.php' ), array( $this, 'settings_link' ) );
31
- // Updated admin notice
32
- add_action( 'admin_notices', array( $this, 'admin_notice' ) );
33
}
34
35
/**
@@ -48,6 +48,16 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
48
}
49
}
50
51
/**
52
* Add Network Menu
53
*/
@@ -354,25 +364,5 @@ if ( ! class_exists( 'GADWP_Backend_Setup' ) ) {
354
array_unshift( $links, $settings_link );
355
return $links;
356
}
357
-
358
- /**
359
- * Add an admin notice after a manual or atuomatic update
360
- */
361
- function admin_notice() {
362
- $currentScreen = get_current_screen();
363
-
364
- if ( ! current_user_can( 'manage_options' ) || strpos( $currentScreen->base, '_gadwp_' ) === false ) {
365
- return;
366
- }
367
-
368
- if ( get_option( 'gadwp_got_updated' ) ) :
369
- ?>
370
- <div id="gadwp-notice" class="notice is-dismissible">
371
- <p><?php echo sprintf( __('Google Analytics Dashboard for WP has been updated to version %s.', 'google-analytics-dashboard-for-wp' ), GADWP_CURRENT_VERSION).' '.sprintf( __('For details, check out %1$s.', 'google-analytics-dashboard-for-wp' ), sprintf(' <a href="https://exactmetrics.com/?utm_source=gadwp_notice&utm_medium=link&utm_content=release_notice&utm_campaign=gadwp">%s</a>', __('the plugin documentation', 'google-analytics-dashboard-for-wp') ) ); ?></p>
372
- </div>
373
-
374
- <?php
375
- endif;
376
- }
377
}
378
}
28
add_action( 'network_admin_menu', array( $this, 'network_menu' ) );
29
// Settings link
30
add_filter( "plugin_action_links_" . plugin_basename( GADWP_DIR . 'gadwp.php' ), array( $this, 'settings_link' ) );
31
+ // AM Notices
32
+ add_filter( "am_notifications_display", array( $this, 'notice_optout' ), 10, 1 );
33
}
34
35
/**
48
}
49
}
50
51
+ public function notice_optout( $super_admin ) {
52
+ if ( ( isset( $this->gadwp->config->options['hide_am_notices'] ) && $this->gadwp->config->options['hide_am_notices'] ) ||
53
+ ( isset( $this->gadwp->config->options['network_hide_am_notices'] ) && $this->gadwp->config->options['network_hide_am_notices'] )
54
+ )
55
+ {
56
+ return false;
57
+ }
58
+ return $super_admin;
59
+ }
60
+
61
/**
62
* Add Network Menu
63
*/
364
array_unshift( $links, $settings_link );
365
return $links;
366
}
367
}
368
}
admin/tracking.php ADDED
@@ -0,0 +1,283 @@
1
+ <?php
2
+ /**
3
+ * Tracking functions for reporting plugin usage to the site for users that have opted in
4
+ *
5
+ * @package ExactMetrics
6
+ * @subpackage Admin
7
+ * @copyright Copyright (c) 2018, Chris Christoff
8
+ * @since 5.3.4
9
+ */
10
+
11
+ // Exit if accessed directly
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ /**
17
+ * Usage tracking
18
+ *
19
+ * @access public
20
+ * @since 7.0.0
21
+ * @return void
22
+ */
23
+ class ExactMetrics_Tracking {
24
+
25
+ public function __construct() {
26
+ $this->gadwp = GADWP();
27
+ add_action( 'init', array( $this, 'schedule_send' ) );
28
+ add_action( 'admin_head', array( $this, 'check_for_optin' ) );
29
+ add_action( 'admin_head', array( $this, 'check_for_optout' ) );
30
+ add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
31
+ add_action( 'exactmetrics_usage_tracking_cron', array( $this, 'send_checkin' ) );
32
+ add_action( 'exactmetrics_settings_usage_tracking', array( $this, 'check_for_settings_optin' ) );
33
+ add_action( 'admin_notices', array( $this, 'setup_notice' ), 999 );
34
+ }
35
+
36
+ private function get_data() {
37
+ $data = array();
38
+
39
+ $options = get_option( 'gadwp_options' );
40
+ if ( empty( $options ) ) {
41
+ $options = array();
42
+ } else {
43
+ $options = (array) json_decode( $options );
44
+ }
45
+
46
+ $network_options = get_site_option( 'gadwp_network_options' );
47
+ if ( empty( $network_options ) ) {
48
+ $network_options = array();
49
+ } else {
50
+ $network_options = (array) json_decode( $network_options );
51
+ }
52
+
53
+ // Foreach network options, prefix with network
54
+ if ( ! empty ( $network_options ) ) {
55
+ foreach ( $network_options as $noptionid => $noptionvalue ) {
56
+ $new_id = 'network_' . $noptionid;
57
+ $options[ $new_id ] = $noptionvalue;
58
+ }
59
+ }
60
+
61
+ // Ensure tokens and secrets are never sent to us
62
+ unset( $options['token'] );
63
+ unset( $options['client_secret'] );
64
+ unset( $options['network_token'] );
65
+ unset( $options['network_client_secret'] );
66
+
67
+ // Retrieve current theme info
68
+ $theme_data = wp_get_theme();
69
+
70
+ $tracking_mode = 'default';
71
+ if ( ! empty( $options['tracking_type'] ) || ! empty( $options['network_tracking_type'] ) ) {
72
+ $tracking_mode = 'minor';
73
+ }
74
+ if ( ! empty( $options['ga_with_gtag'] ) || ! empty( $options['network_ga_with_gtag'] ) ) {
75
+ $tracking_mode = 'gtag';
76
+ }
77
+
78
+ $update_mode = 'none';
79
+ if ( ! empty( $options['automatic_updates_minorversion'] ) || ! empty( $options['network_automatic_updates_minorversion'] ) ) {
80
+ $update_mode = 'minor';
81
+ }
82
+
83
+
84
+ $count_b = 1;
85
+ if ( is_multisite() ) {
86
+ if ( function_exists( 'get_blog_count' ) ) {
87
+ $count_b = get_blog_count();
88
+ } else {
89
+ $count_b = 'Not Set';
90
+ }
91
+ }
92
+
93
+ $data['php_version'] = phpversion();
94
+ $data['mi_version'] = GADWP_CURRENT_VERSION;
95
+ $data['wp_version'] = get_bloginfo( 'version' );
96
+ $data['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
97
+ $data['multisite'] = is_multisite();
98
+ $data['url'] = home_url();
99
+ $data['themename'] = $theme_data->Name;
100
+ $data['themeversion'] = $theme_data->Version;
101
+ $data['settings'] = $options;
102
+ $data['tracking_mode'] = $tracking_mode;
103
+ $data['autoupdate'] = $update_mode;
104
+ $data['sites'] = $count_b;
105
+ $data['usagetracking'] = get_option( 'exactmetrics_usage_tracking_config', false );
106
+ $data['usercount'] = function_exists( 'get_user_count' ) ? get_user_count() : 'Not Set';
107
+ $data['timezoneoffset']= date('P');
108
+
109
+
110
+
111
+ // Retrieve current plugin information
112
+ if( ! function_exists( 'get_plugins' ) ) {
113
+ include ABSPATH . '/wp-admin/includes/plugin.php';
114
+ }
115
+
116
+ $plugins = array_keys( get_plugins() );
117
+ $active_plugins = get_option( 'active_plugins', array() );
118
+
119
+ foreach ( $plugins as $key => $plugin ) {
120
+ if ( in_array( $plugin, $active_plugins ) ) {
121
+ // Remove active plugins from list so we can show active and inactive separately
122
+ unset( $plugins[ $key ] );
123
+ }
124
+ }
125
+
126
+ $data['active_plugins'] = $active_plugins;
127
+ $data['inactive_plugins'] = $plugins;
128
+ $data['locale'] = get_locale();
129
+
130
+ return $data;
131
+ }
132
+
133
+ public function send_checkin( $override = false, $ignore_last_checkin = false ) {
134
+
135
+ $home_url = trailingslashit( home_url() );
136
+ if ( strpos( $home_url, 'exactmetrics.com' ) !== false ) {
137
+ return false;
138
+ }
139
+
140
+ if( ! $this->tracking_allowed() && ! $override ) {
141
+ return false;
142
+ }
143
+
144
+ // Send a maximum of once per week
145
+ $last_send = get_option( 'exactmetrics_usage_tracking_last_checkin' );
146
+ if ( is_numeric( $last_send ) && $last_send > strtotime( '-1 week' ) && ! $ignore_last_checkin ) {
147
+ return false;
148
+ }
149
+
150
+ $request = wp_remote_post( 'https://miusage.com/v1/em-checkin/', array(
151
+ 'method' => 'POST',
152
+ 'timeout' => 5,
153
+ 'redirection' => 5,
154
+ 'httpversion' => '1.1',
155
+ 'blocking' => false,
156
+ 'body' => $this->get_data(),
157
+ 'user-agent' => 'EM/' . GADWP_CURRENT_VERSION . '; ' . get_bloginfo( 'url' )
158
+ ) );
159
+
160
+ // If we have completed successfully, recheck in 1 week
161
+ update_option( 'exactmetrics_usage_tracking_last_checkin', time() );
162
+ return true;
163
+ }
164
+
165
+ private function tracking_allowed() {
166
+ return (bool) $this->get_option( 'usage_tracking', 0 );
167
+ }
168
+
169
+ public function schedule_send() {
170
+ if ( ! wp_next_scheduled( 'exactmetrics_usage_tracking_cron' ) ) {
171
+ $tracking = array();
172
+ $tracking['day'] = rand( 0, 6 );
173
+ $tracking['hour'] = rand( 0, 23 );
174
+ $tracking['minute'] = rand( 0, 59 );
175
+ $tracking['second'] = rand( 0, 59 );
176
+ $tracking['offset'] = ( $tracking['day'] * DAY_IN_SECONDS ) +
177
+ ( $tracking['hour'] * HOUR_IN_SECONDS ) +
178
+ ( $tracking['minute'] * MINUTE_IN_SECONDS ) +
179
+ $tracking['second'];
180
+ $tracking['initsend'] = strtotime("next sunday") + $tracking['offset'];
181
+
182
+ wp_schedule_event( $tracking['initsend'], 'weekly', 'exactmetrics_usage_tracking_cron' );
183
+ update_option( 'exactmetrics_usage_tracking_config', $tracking );
184
+ }
185
+ }
186
+
187
+ public function check_for_settings_optin( $new_value ) {
188
+ if ( ! current_user_can( 'manage_options' ) ) {
189
+ return;
190
+ }
191
+
192
+ $new_value = intval( $new_value );
193
+ $current_value = $this->get_option( 'usage_tracking', 0 );
194
+
195
+ if ( $current_value == $new_value ) {
196
+ return;
197
+ }
198
+
199
+ if ( $new_value ) {
200
+ $this->send_checkin( true, true );
201
+ update_option( 'exactmetrics_tracking_notice', 1 );
202
+ } else {
203
+ update_option( 'exactmetrics_tracking_notice', 0 );
204
+ }
205
+ }
206
+
207
+ public function check_for_optin() {
208
+ if ( ! ( ! empty( $_REQUEST['em_action'] ) && 'opt_into_tracking' === $_REQUEST['em_action'] ) ) {
209
+ return;
210
+ }
211
+
212
+ if ( $this->get_option( 'usage_tracking', 0 ) ) {
213
+ return;
214
+ }
215
+
216
+ if ( ! current_user_can( 'manage_options' ) ) {
217
+ return;
218
+ }
219
+
220
+ $this->set_option( 'usage_tracking', 1 );
221
+ $this->send_checkin( true, true );
222
+ update_option( 'exactmetrics_tracking_notice', 1 );
223
+ }
224
+
225
+ public function check_for_optout() {
226
+ if ( ! ( ! empty( $_REQUEST['em_action'] ) && 'opt_out_of_tracking' === $_REQUEST['em_action'] ) ) {
227
+ return;
228
+ }
229
+
230
+ if ( $this->get_option( 'usage_tracking', 0 ) ) {
231
+ return;
232
+ }
233
+
234
+ if ( ! current_user_can( 'manage_options' ) ) {
235
+ return;
236
+ }
237
+
238
+ $this->set_option( 'usage_tracking', 0 );
239
+ update_option( 'exactmetrics_tracking_notice', 1 );
240
+ }
241
+
242
+ public function setup_notice(){
243
+ if ( ! is_network_admin() && ( ! isset( $_GET['page'] ) || ( isset( $_GET['page'] ) && $_GET['page'] !== 'gadwp_tracking_settings' ) && $_GET['page'] !== 'gadwp_settings' ) ) {
244
+ if ( ! get_option( 'exactmetrics_tracking_notice' ) ) {
245
+ if ( ! $this->get_option( 'usage_tracking', 0 ) ) {
246
+ $optin_url = add_query_arg( 'em_action', 'opt_into_tracking' );
247
+ $optout_url = add_query_arg( 'em_action', 'opt_out_of_tracking' );
248
+ echo '<div class="updated"><p>';
249
+ echo sprintf( esc_html__( 'ExactMetrics would like to better understand how our users use our plugin so we can get a better understanding of which features and bugfixes to prioritize. %1$sCan we collect some %2$sinformation about our plugin usage?%3$s', 'google-analytics-dashboard-for-wp' ), '<br />', '<a href="https://exactmetrics.com/usage-tracking/?utm_source=wpdashboard&utm_campaign=usagetracking&utm_medium=plugin" target="_blank">', '</a>' );
250
+ echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-secondary">' . __( 'Yes, I\'d like to help out', 'google-analytics-dashboard-for-wp' ) . '</a>';
251
+ echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . __( 'No thanks', 'google-analytics-dashboard-for-wp' ) . '</a>';
252
+ echo '</p></div>';
253
+ return;
254
+ }
255
+ }
256
+ }
257
+ }
258
+
259
+ public function add_schedules( $schedules = array() ) {
260
+ // Adds once weekly to the existing schedules.
261
+ $schedules['weekly'] = array(
262
+ 'interval' => 604800,
263
+ 'display' => __( 'Once Weekly', 'google-analytics-dashboard-for-wp' )
264
+ );
265
+ return $schedules;
266
+ }
267
+
268
+ public function get_option( $option, $default = false ) {
269
+ if ( ! empty( $this->gadwp->config->options ) && is_array( $this->gadwp->config->options ) && isset( $this->gadwp->config->options[$option] ) ) {
270
+ return $this->gadwp->config->options[$option];
271
+ } else {
272
+ return $default;
273
+ }
274
+ }
275
+
276
+ public function set_option( $option, $value ) {
277
+ $new_options = array();
278
+ $new_options[$option] = $value;
279
+ $options = array_merge( $this->gadwp->config->options, $new_options );
280
+ $this->gadwp->config->options = $options;
281
+ $this->gadwp->config->set_plugin_options( false );
282
+ }
283
+ }
config.php CHANGED
@@ -1,6 +1,6 @@
1
<?php
2
/**
3
- * Author: ExactMetrics team
4
* Author URI: https://exactmetrics.com
5
* Copyright 2018 ExactMetrics team
6
* License: GPLv2 or later
@@ -101,6 +101,9 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
101
'tm_optout',
102
'tm_dnt_optout',
103
'ga_with_gtag',
104
);
105
foreach ( $numerics as $key ) {
106
if ( isset( $options[$key] ) ) {
@@ -299,6 +302,9 @@ if ( ! class_exists( 'GADWP_Config' ) ) {
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] ) ) {
1
<?php
2
/**
3
+ * Author: ExactMetrics
4
* Author URI: https://exactmetrics.com
5
* Copyright 2018 ExactMetrics team
6
* License: GPLv2 or later
101
'tm_optout',
102
'tm_dnt_optout',
103
'ga_with_gtag',
104
+ 'usage_tracking',
105
+ 'hide_am_notices',
106
+ 'network_hide_am_notices',
107
);
108
foreach ( $numerics as $key ) {
109
if ( isset( $options[$key] ) ) {
302
'frontend_item_reports',
303
'tm_optout', //v5.3.1.2
304
'tm_dnt_optout', //v5.3.1.2
305
+ 'usage_tracking', //v5.3.4
306
+ 'hide_am_notices', //v5.3.4
307
+ 'network_hide_am_notices', //v5.3.4
308
);
309
foreach ( $zeros as $key ) {
310
if ( ! isset( $this->options[$key] ) ) {
front/views/analytics-code.php CHANGED
@@ -9,7 +9,7 @@
9
?>
10
11
<?php if ( 0 == $data['ga_with_gtag'] ):?>
12
- <!-- BEGIN GADWP v<?php echo GADWP_CURRENT_VERSION; ?> Universal Analytics - https://exactmetrics.com/ -->
13
<script>
14
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
15
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -17,9 +17,9 @@
17
})(window,document,'script','<?php echo $data['tracking_script_path']?>','ga');
18
<?php echo $data['trackingcode']?>
19
</script>
20
- <!-- END GADWP Universal Analytics -->
21
<?php else:?>
22
- <!-- BEGIN GADWP v<?php echo GADWP_CURRENT_VERSION; ?> Global Site Tag - https://exactmetrics.com/ -->
23
<script async src="<?php echo $data['tracking_script_path']?>?id=<?php echo $data['uaid']?>"></script>
24
<script>
25
window.dataLayer = window.dataLayer || [];
@@ -36,5 +36,5 @@
36
});
37
}
38
</script>
39
- <!-- END GADWP Global Site Tag -->
40
<?php endif;?>
9
?>
10
11
<?php if ( 0 == $data['ga_with_gtag'] ):?>
12
+ <!-- BEGIN ExactMetrics v<?php echo GADWP_CURRENT_VERSION; ?> Universal Analytics - https://exactmetrics.com/ -->
13
<script>
14
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
15
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
17
})(window,document,'script','<?php echo $data['tracking_script_path']?>','ga');
18
<?php echo $data['trackingcode']?>
19
</script>
20
+ <!-- END ExactMetrics Universal Analytics -->
21
<?php else:?>
22
+ <!-- BEGIN ExactMetrics v<?php echo GADWP_CURRENT_VERSION; ?> Global Site Tag - https://exactmetrics.com/ -->
23
<script async src="<?php echo $data['tracking_script_path']?>?id=<?php echo $data['uaid']?>"></script>
24
<script>
25
window.dataLayer = window.dataLayer || [];
36
});
37
}
38
</script>
39
+ <!-- END ExactMetrics Global Site Tag -->
40
<?php endif;?>
gadwp.php CHANGED
@@ -3,8 +3,8 @@
3
* Plugin Name: Google Analytics Dashboard for WP (GADWP)
4
* Plugin URI: https://exactmetrics.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: ExactMetrics team
7
- * Version: 5.3.3
8
* Author URI: https://exactmetrics.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.3' );
20
}
21
22
if ( ! defined( 'GADWP_ENDPOINT_URL' ) ) {
@@ -52,6 +52,8 @@ if ( ! class_exists( 'GADWP_Manager' ) ) {
52
53
public $gapi_controller = null;
54
55
/**
56
* Construct forbidden
57
*/
@@ -239,6 +241,9 @@ if ( ! class_exists( 'GADWP_Manager' ) ) {
239
include_once ( GADWP_DIR . 'admin/item-reports.php' );
240
self::$instance->backend_item_reports = new GADWP_Backend_Item_Reports();
241
}
242
}
243
} else {
244
if ( GADWP_Tools::check_roles( self::$instance->config->options['access_front'] ) ) {
3
* Plugin Name: Google Analytics Dashboard for WP (GADWP)
4
* Plugin URI: https://exactmetrics.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: ExactMetrics
7
+ * Version: 5.3.5
8
* Author URI: https://exactmetrics.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.5' );
20
}
21
22
if ( ! defined( 'GADWP_ENDPOINT_URL' ) ) {
52
53
public $gapi_controller = null;
54
55
+ public $usage_tracking = null;
56
+
57
/**
58
* Construct forbidden
59
*/
241
include_once ( GADWP_DIR . 'admin/item-reports.php' );
242
self::$instance->backend_item_reports = new GADWP_Backend_Item_Reports();
243
}
244
+
245
+ include_once ( GADWP_DIR . 'admin/tracking.php' );
246
+ self::$instance->usage_tracking = new ExactMetrics_Tracking();
247
}
248
} else {
249
if ( GADWP_Tools::check_roles( self::$instance->config->options['access_front'] ) ) {
install/install.php CHANGED
@@ -90,6 +90,9 @@ class GADWP_Install {
90
$options['tm_optout'] = 0;
91
$options['tm_dnt_optout'] = 0;
92
$options['ga_with_gtag'] = 0;
93
} else {
94
$options = array();
95
$options['client_id'] = get_option( 'ga_dash_clientid' );
@@ -165,7 +168,9 @@ class GADWP_Install {
165
$options['tm_optout'] = 0;
166
$options['tm_dnt_optout'] = 0;
167
$options['ga_with_gtag'] = 0;
168
-
169
delete_option( 'ga_dash_clientid' );
170
delete_option( 'ga_dash_clientsecret' );
171
delete_option( 'ga_dash_access' );
90
$options['tm_optout'] = 0;
91
$options['tm_dnt_optout'] = 0;
92
$options['ga_with_gtag'] = 0;
93
+ $options['usage_tracking'] = 0;
94
+ $options['hide_am_notices'] = 0;
95
+ $options['network_hide_am_notices'] = 0;
96
} else {
97
$options = array();
98
$options['client_id'] = get_option( 'ga_dash_clientid' );
168
$options['tm_optout'] = 0;
169
$options['tm_dnt_optout'] = 0;
170
$options['ga_with_gtag'] = 0;
171
+ $options['usage_tracking'] = 0;
172
+ $options['hide_am_notices'] = 0;
173
+ $options['network_hide_am_notices'] = 0;
174
delete_option( 'ga_dash_clientid' );
175
delete_option( 'ga_dash_clientsecret' );
176
delete_option( 'ga_dash_access' );
install/uninstall.php CHANGED
@@ -20,12 +20,20 @@ class GADWP_Uninstall {
20
switch_to_blog( $blog['blog_id'] );
21
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_%%'" );
22
delete_option( 'gadwp_options' );
23
restore_current_blog();
24
}
25
delete_site_option( 'gadwp_network_options' );
26
} else { // Cleanup Single install
27
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_%%'" );
28
delete_option( 'gadwp_options' );
29
}
30
GADWP_Tools::unset_cookie( 'default_metric' );
31
GADWP_Tools::unset_cookie( 'default_dimension' );
20
switch_to_blog( $blog['blog_id'] );
21
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_%%'" );
22
delete_option( 'gadwp_options' );
23
+ delete_option( 'exactmetrics_tracking_notice');
24
+ delete_option( 'exactmetrics_usage_tracking_last_checkin');
25
+ delete_option( 'exactmetrics_usage_tracking_config');
26
+ wp_clear_scheduled_hook( 'exactmetrics_usage_tracking_cron' );
27
restore_current_blog();
28
}
29
delete_site_option( 'gadwp_network_options' );
30
} else { // Cleanup Single install
31
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'gadwp_cache_%%'" );
32
delete_option( 'gadwp_options' );
33
+ delete_option( 'exactmetrics_tracking_notice');
34
+ delete_option( 'exactmetrics_usage_tracking_last_checkin');
35
+ delete_option( 'exactmetrics_usage_tracking_config');
36
+ wp_clear_scheduled_hook( 'exactmetrics_usage_tracking_cron' );
37
}
38
GADWP_Tools::unset_cookie( 'default_metric' );
39
GADWP_Tools::unset_cookie( 'default_dimension' );
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Google Analytics Dashboard for WP (GADWP) ===
2
Contributors: chriscct7, smub
3
Donate link: http://www.wpbeginner.com/wpbeginner-needs-your-help/
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
7
- Stable tag: 5.3.3
8
Requires PHP: 5.2.4
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -16,7 +16,7 @@ This Google Analytics for WordPress plugin enables you to track your site using
16
17
In addition to a set of general Google Analytics stats, in-depth Page reports and in-depth Post reports allow further segmentation of your analytics data, providing performance details for each post or page from your website.
18
19
- The Google Analytics tracking code is fully customizable through options and hooks, allowing advanced data collection like custom dimensions and events.
20
21
= Google Analytics Real-Time Stats =
22
@@ -112,7 +112,7 @@ This plugin is fully compatible with multisite network installs, allowing three
112
- Mode 3: network deactivated using multiple Google Analytics accounts
113
114
> <strong>Google Analytics Dashboard for WP on GitHub</strong><br>
115
- > You can submit feature requests or bugs on [Google Analytics Dashboard for WP](https://github.com/awesomemotive/Google-Analytics-Dashboard-for-WP) repository.
116
117
== Installation ==
118
@@ -139,7 +139,7 @@ You can submit pull requests, feature requests and bug reports on [our GitHub re
139
140
= Documentation, Tutorials and FAQ =
141
142
- For documentation, tutorials, FAQ and videos check out: [Google Analytics Dashboard for WP documentation](https://exactmetrics.com/).
143
144
== Screenshots ==
145
@@ -167,6 +167,16 @@ Google Analytics Dashboard for WP it's released under the GPLv2, you can use it
167
168
[GADWP v5.3 release notes](https://exactmetrics.com/adding-gtag-js-to-your-site/)
169
170
= 5.3.3 =
171
* Bug Fixes:
172
* Updated endpoint for GA auth to use updated system.
1
+ === Google Analytics Dashboard for WP by ExactMetrics (formerly GADWP) ===
2
Contributors: chriscct7, smub
3
Donate link: http://www.wpbeginner.com/wpbeginner-needs-your-help/
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
7
+ Stable tag: 5.3.5
8
Requires PHP: 5.2.4
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
16
17
In addition to a set of general Google Analytics stats, in-depth Page reports and in-depth Post reports allow further segmentation of your analytics data, providing performance details for each post or page from your website.
18
19
+ The Google Analytics tracking code is fully customizable through options and hooks, allowing advanced data collection like custom dimensions and events.
20
21
= Google Analytics Real-Time Stats =
22
112
- Mode 3: network deactivated using multiple Google Analytics accounts
113
114
> <strong>Google Analytics Dashboard for WP on GitHub</strong><br>
115
+ > You can submit feature requests or bugs on [the Google Analytics Dashboard for WP by ExactMetrics Github repository](https://github.com/awesomemotive/Google-Analytics-Dashboard-for-WP).
116
117
== Installation ==
118
139
140
= Documentation, Tutorials and FAQ =
141
142
+ For documentation, tutorials, FAQ and videos check out: [Google Analytics Dashboard for WP by ExactMetrics documentation](https://exactmetrics.com/).
143
144
== Screenshots ==
145
167
168
[GADWP v5.3 release notes](https://exactmetrics.com/adding-gtag-js-to-your-site/)
169
170
+ = 5.3.5 =
171
+ * Bug Fixes:
172
+ * Re-tagging release to fix a deployment issue.
173
+
174
+ = 5.3.4 =
175
+ * Enhancements:
176
+ * Adds more robust settings to control various ExactMetrics configuration warnings.
177
+ * Adds the ability to opt-into usage tracking.
178
+
179
+
180
= 5.3.3 =
181
* Bug Fixes:
182
* Updated endpoint for GA auth to use updated system.