Google Analytics for WordPress by MonsterInsights - Version 6.2.4

Version Description

= 6.0.0 =

This is a major release. Please back up your site before upgrading.

Download this release

Release Info

Developer chriscct7
Plugin Icon 128x128 Google Analytics for WordPress by MonsterInsights
Version 6.2.4
Comparing to
See all releases

Code changes from version 6.2.3 to 6.2.4

Files changed (3) hide show
  1. googleanalytics.php +2 -2
  2. includes/admin/tracking.php +18 -5
  3. readme.txt +5 -2
googleanalytics.php CHANGED
@@ -6,7 +6,7 @@
6
  * Author: MonsterInsights
7
  * Author URI: https://www.monsterinsights.com/
8
  *
9
- * Version: 6.2.3
10
  * Requires at least: 3.9.0
11
  * Tested up to: 4.8.1
12
  *
@@ -69,7 +69,7 @@ final class MonsterInsights_Lite {
69
  * @access public
70
  * @var string $version Plugin version.
71
  */
72
- public $version = '6.2.3';
73
 
74
  /**
75
  * Plugin file.
6
  * Author: MonsterInsights
7
  * Author URI: https://www.monsterinsights.com/
8
  *
9
+ * Version: 6.2.4
10
  * Requires at least: 3.9.0
11
  * Tested up to: 4.8.1
12
  *
69
  * @access public
70
  * @var string $version Plugin version.
71
  */
72
+ public $version = '6.2.4';
73
 
74
  /**
75
  * Plugin file.
includes/admin/tracking.php CHANGED
@@ -43,6 +43,7 @@ class MonsterInsights_Tracking {
43
  add_action( 'admin_notices', array( $this, 'monsterinsights_admin_notice' ),7 );
44
  add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
45
  add_action( 'monsterinsights_daily_cron', array( $this, 'send_checkin' ) );
 
46
  }
47
 
48
  /**
@@ -144,10 +145,19 @@ class MonsterInsights_Tracking {
144
 
145
  // Send a maximum of once per week
146
  $last_send = $this->get_last_send();
147
- if( is_numeric( $last_send ) && $last_send > strtotime( '-1 week' ) && ! $ignore_last_checkin ) {
148
  return false;
149
  }
150
 
 
 
 
 
 
 
 
 
 
151
  $this->setup_data();
152
 
153
  $request = wp_remote_post( 'https://www.monsterinsights.com/?edd_action=checkin', array(
@@ -160,12 +170,15 @@ class MonsterInsights_Tracking {
160
  'user-agent' => 'MI/' . MONSTERINSIGHTS_VERSION . '; ' . get_bloginfo( 'url' )
161
  ) );
162
 
163
- if( is_wp_error( $request ) ) {
164
- return $request;
 
 
 
 
 
165
  }
166
 
167
- update_option( 'mi_tracking_last_send', time() );
168
-
169
  return true;
170
 
171
  }
43
  add_action( 'admin_notices', array( $this, 'monsterinsights_admin_notice' ),7 );
44
  add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
45
  add_action( 'monsterinsights_daily_cron', array( $this, 'send_checkin' ) );
46
+ add_action( 'monsterinsights_send_tracking_data', array( $this, 'send_tracking_data' ) );
47
  }
48
 
49
  /**
145
 
146
  // Send a maximum of once per week
147
  $last_send = $this->get_last_send();
148
+ if ( is_numeric( $last_send ) && $last_send > strtotime( '-1 week' ) && ! $ignore_last_checkin ) {
149
  return false;
150
  }
151
 
152
+ $hours = (int) rand( 0 , 23 );
153
+ $minutes = (int) rand( 0 , 59 );
154
+ $seconds = (int) rand( 0 , 59 );
155
+ wp_schedule_single_event( time() + ( $hours * $minutes * $seconds ), 'monsterinsights_send_tracking_data' );
156
+ return true;
157
+ }
158
+
159
+ public function send_tracking_data( ) {
160
+
161
  $this->setup_data();
162
 
163
  $request = wp_remote_post( 'https://www.monsterinsights.com/?edd_action=checkin', array(
170
  'user-agent' => 'MI/' . MONSTERINSIGHTS_VERSION . '; ' . get_bloginfo( 'url' )
171
  ) );
172
 
173
+ if ( is_wp_error( $request ) ) {
174
+ // If we have not completed successfully, re-check in a random amount of days
175
+ $days = (int) rand ( 0 , 6 );
176
+ update_option( 'mi_tracking_last_send', time() + ( $days * 24 * 60 * 60) );
177
+ } else {
178
+ // If we have completed successfully, recheck in 1 week
179
+ update_option( 'mi_tracking_last_send', time() );
180
  }
181
 
 
 
182
  return true;
183
 
184
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.wpbeginner.com/wpbeginner-needs-your-help/
4
  Tags: analytics, analytics dashboard, google analytics, google analytics dashboard, google analytics widget, universal google analytics, statistics, tracking, stats, google, yoast, google analytics by yoast, ga, monster insights, monsterinsights, universal analytics, web stats, ecommerce, ecommerce tracking
5
  Requires at least: 3.9
6
  Tested up to: 4.8.1
7
- Stable tag: 6.2.3
8
  License: GPL v3
9
 
10
  The best Google Analytics plugin for WordPress. See how visitors find and use your website, so you can keep them coming back.
@@ -136,7 +136,10 @@ You can also learn about other <a href="http://www.wpbeginner.com/category/plugi
136
  4. Want more features? <a href="https://www.monsterinsights.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion">Purchase MonsterInsights Pro</a>!
137
 
138
  == Changelog ==
139
- = 6.2.3: September, 9, 2017 =
 
 
 
140
  * Tweak: Added a notice for new users of MonsterInsights about when the reports will begin populating.
141
 
142
  = 6.2.2: August 16, 2017 =
4
  Tags: analytics, analytics dashboard, google analytics, google analytics dashboard, google analytics widget, universal google analytics, statistics, tracking, stats, google, yoast, google analytics by yoast, ga, monster insights, monsterinsights, universal analytics, web stats, ecommerce, ecommerce tracking
5
  Requires at least: 3.9
6
  Tested up to: 4.8.1
7
+ Stable tag: 6.2.4
8
  License: GPL v3
9
 
10
  The best Google Analytics plugin for WordPress. See how visitors find and use your website, so you can keep them coming back.
136
  4. Want more features? <a href="https://www.monsterinsights.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion">Purchase MonsterInsights Pro</a>!
137
 
138
  == Changelog ==
139
+ = 6.2.4: October 6, 2017 =
140
+ * Tweak: Adjusted how the optin tracking is sent to us.
141
+
142
+ = 6.2.3: September 9, 2017 =
143
  * Tweak: Added a notice for new users of MonsterInsights about when the reports will begin populating.
144
 
145
  = 6.2.2: August 16, 2017 =