Google Analytics for WordPress by MonsterInsights - Version 6.0.13

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.0.13
Comparing to
See all releases

Code changes from version 6.0.12 to 6.0.13

assets/js/frontend.js CHANGED
@@ -16,8 +16,12 @@
16
  // us to polyfill Array.prototype.lastIndexOf, and if they continue to drop, we might remove this polyfill at some point. In that case note that events tracking
17
  // for IE 7/8 will continue to work, with the exception of events tracking of downloads.
18
  function __gaTrackerClickEventPHP() {
 
 
 
 
19
  var phpvalues = {
20
- 'is_debug_mode' : monsterinsights_frontend.is_debug_mode,
21
  'download_extensions' : monsterinsights_frontend.download_extensions, /* Let's get the extensions to track */
22
  'inbound_paths' : monsterinsights_frontend.inbound_paths, /* Let's get the internal paths to track */
23
  'home_url' : monsterinsights_frontend.home_url, /* Let's get the url to compare for external/internal use */
@@ -39,11 +43,14 @@
39
  console.log( "Event.which: " + event.which );
40
  console.log( "El: ");
41
  console.log( el );
42
- console.log( "Will track: " + ! ( ! __gaTracker.hasOwnProperty( "loaded" ) || __gaTracker.loaded != true || ( event.which != 1 && event.which != 2 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey ) ) ) ;
43
  }
44
 
45
  /* If GA is blocked or not loaded, or not main|middle|touch click then don't track */
46
  if ( ! __gaTracker.hasOwnProperty( "loaded" ) || __gaTracker.loaded != true || ( event.which != 1 && event.which != 2 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey ) ) {
 
 
 
47
  return;
48
  }
49
 
@@ -73,6 +80,10 @@
73
  var track_download_as = phpvalues.track_download_as; /* should downloads be tracked as events or pageviews */
74
  var internal_label = "outbound-link-" + phpvalues.internal_label; /* What is the prefix for internal-as-external links */
75
 
 
 
 
 
76
  /* Remove the anchor at the end, if there is one */
77
  extension = extension.substring( 0, (extension.indexOf( "#" ) == -1 ) ? extension.length : extension.indexOf( "#" ) );
78
 
@@ -296,10 +307,6 @@
296
  console.log( "Target | " + type + " | " + link + " is not a tracked click." );
297
  }
298
  }
299
-
300
- if ( is_debug_mode ) {
301
- return false;
302
- }
303
  } else { /* Prevent standard click, track then open */
304
  if (!event.defaultPrevented) {
305
  event.preventDefault ? event.preventDefault() : event.returnValue = !1;
@@ -356,15 +363,19 @@
356
  console.log( "Not Target | " + type + " | " + link + " is not a tracked click." );
357
  }
358
  }
359
-
360
- if ( is_debug_mode ) {
361
- return false;
362
- }
363
 
364
- /* Run hitCallback again if GA takes longer than 1 second */
365
- setTimeout( __gaTrackerHitBack, 1000 );
 
 
 
 
366
  }
367
  }
 
 
 
 
368
  }
369
  }
370
 
16
  // us to polyfill Array.prototype.lastIndexOf, and if they continue to drop, we might remove this polyfill at some point. In that case note that events tracking
17
  // for IE 7/8 will continue to work, with the exception of events tracking of downloads.
18
  function __gaTrackerClickEventPHP() {
19
+ var debug_mode = false;
20
+ if ( monsterinsights_frontend.is_debug_mode === "true" ) {
21
+ debug_mode = true;
22
+ }
23
  var phpvalues = {
24
+ 'is_debug_mode' : debug_mode,
25
  'download_extensions' : monsterinsights_frontend.download_extensions, /* Let's get the extensions to track */
26
  'inbound_paths' : monsterinsights_frontend.inbound_paths, /* Let's get the internal paths to track */
27
  'home_url' : monsterinsights_frontend.home_url, /* Let's get the url to compare for external/internal use */
43
  console.log( "Event.which: " + event.which );
44
  console.log( "El: ");
45
  console.log( el );
46
+ console.log( "GA Loaded and click: " + ! ( ! __gaTracker.hasOwnProperty( "loaded" ) || __gaTracker.loaded != true || ( event.which != 1 && event.which != 2 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey ) ) ) ;
47
  }
48
 
49
  /* If GA is blocked or not loaded, or not main|middle|touch click then don't track */
50
  if ( ! __gaTracker.hasOwnProperty( "loaded" ) || __gaTracker.loaded != true || ( event.which != 1 && event.which != 2 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey ) ) {
51
+ if ( is_debug_mode ) {
52
+ console.log( "Will track: false");
53
+ }
54
  return;
55
  }
56
 
80
  var track_download_as = phpvalues.track_download_as; /* should downloads be tracked as events or pageviews */
81
  var internal_label = "outbound-link-" + phpvalues.internal_label; /* What is the prefix for internal-as-external links */
82
 
83
+ if ( is_debug_mode ) {
84
+ console.log( "Will track: true");
85
+ }
86
+
87
  /* Remove the anchor at the end, if there is one */
88
  extension = extension.substring( 0, (extension.indexOf( "#" ) == -1 ) ? extension.length : extension.indexOf( "#" ) );
89
 
307
  console.log( "Target | " + type + " | " + link + " is not a tracked click." );
308
  }
309
  }
 
 
 
 
310
  } else { /* Prevent standard click, track then open */
311
  if (!event.defaultPrevented) {
312
  event.preventDefault ? event.preventDefault() : event.returnValue = !1;
363
  console.log( "Not Target | " + type + " | " + link + " is not a tracked click." );
364
  }
365
  }
 
 
 
 
366
 
367
+ if ( ! is_debug_mode ) {
368
+ /* Run hitCallback again if GA takes longer than 1 second */
369
+ setTimeout( __gaTrackerHitBack, 1000 );
370
+ } else {
371
+ window.location.href = link;
372
+ }
373
  }
374
  }
375
+ } else {
376
+ if ( is_debug_mode ) {
377
+ console.log( "Will track: false");
378
+ }
379
  }
380
  }
381
 
assets/js/frontend.min.js CHANGED
@@ -1,29 +1,31 @@
1
- (function(){function o(){var e={"is_debug_mode":monsterinsights_frontend.is_debug_mode,"download_extensions":monsterinsights_frontend.download_extensions,"inbound_paths":monsterinsights_frontend.inbound_paths,"home_url":monsterinsights_frontend.home_url,"track_download_as":monsterinsights_frontend.track_download_as,"internal_label":"outbound-link-"+monsterinsights_frontend.internal_label,};return e};function t(e){var s=o(),l=s.is_debug_mode||window.monsterinsights_debug_mode,n=e.srcElement||e.target;if(l){console.log("__gaTracker.hasOwnProperty(loaded)");console.log(__gaTracker.hasOwnProperty("loaded"));console.log("__gaTracker.loaded");console.log(__gaTracker.loaded);console.log("Event.which: "+e.which);console.log("El: ");console.log(n);console.log("Will track: "+!(!__gaTracker.hasOwnProperty("loaded")||__gaTracker.loaded!=!0||(e.which!=1&&e.which!=2&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey)))};if(!__gaTracker.hasOwnProperty("loaded")||__gaTracker.loaded!=!0||(e.which!=1&&e.which!=2&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey)){return}
2
- while(n&&(typeof n.tagName=="undefined"||n.tagName.toLowerCase()!="a"||!n.href)){n=n.parentNode};if(n&&n.href){var t=n.href,a=n.href,i="internal",m=s.download_extensions,w=s.inbound_paths,b=s.home_url,p=s.track_download_as,c="outbound-link-"+s.internal_label;a=a.substring(0,(a.indexOf("#")==-1)?a.length:a.indexOf("#"));a=a.substring(0,(a.indexOf("?")==-1)?a.length:a.indexOf("?"));a=a.substring(a.lastIndexOf("/")+1,a.length);a=a.substring(a.indexOf(".")+1);var d=(function(){var t=0,e=document.domain,o=e.split("."),n="_gd"+(new Date()).getTime();while(t<(o.length-1)&&document.cookie.indexOf(n+"="+n)==-1){e=o.slice(-1-(++t)).join(".");document.cookie=n+"="+n+";domain="+e+";"};document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain="+e+";";return e})();if(typeof String.prototype.endsWith!=="function"){String.prototype.endsWith=function(e){return this.indexOf(e,this.length-e.length)!==-1}};if(typeof String.prototype.startsWith!=="function"){String.prototype.startsWith=function(e){return this.indexOf(e)===0}};if(typeof Array.prototype.includes!=="function"){Object.defineProperty(Array.prototype,"includes",{value:function(e,l){if(this==null){throw new TypeError("\"this\" is null or not defined")};var a=Object(this),o=a.length>>>0;if(o===0){return!1};var n=l|0,t=Math.max(n>=0?n:o-Math.abs(n),0);while(t<o){if(a[t]===e){return!0};t++};return!1}})};if(typeof Array.prototype.lastIndexOf!=="function"){Array.prototype.lastIndexOf=function(n){"use strict";if(this===void 0||this===null){throw new TypeError()};var e,t,a=Object(this),o=a.length>>>0;if(o===0){return-1};e=o-1;if(arguments.length>1){e=Number(arguments[1]);if(e!=e){e=0}
3
- else if(e!=0&&e!=(1/0)&&e!=-(1/0)){e=(e>0||-1)*Math.floor(Math.abs(e))}};for(t=e>=0?Math.min(e,o-1):o-Math.abs(e);t>=0;t--){if(t in a&&a[t]===n){return t}};return-1}};function v(e){return e.replace(/^\s+|\s+$/gm,"")};if(l){console.log("Link: "+t);console.log("Extension: "+a);console.log("Protocol: "+n.protocol);console.log("External: "+(n.hostname.length>0&&d.length>0&&!n.hostname.endsWith(d)));console.log("Current domain: "+d);console.log("Link domain: "+n.hostname)};if(v(n.protocol)=="mailto"||v(n.protocol)=="mailto:"){i="mailto"}
4
- else if(m.length>0&&a.length>0&&m.includes(a)){i="download"}
5
  else if(n.hostname.length>0&&d.length>0&&!n.hostname.endsWith(d)){i="external"}
6
- else{var g,u,k=n.pathname;for(g=0,u=w.length;g<u;++g){if(k.startsWith(w[g])){i="internal-as-outbound";break}}};if(l){console.log("Type: "+i)};if(i!=="internal"&&!t.match(/^javascript\:/i)){var f=(n.target&&!n.target.match(/^_(self|parent|top)$/i))?n.target:!1;if(e.ctrlKey||e.shiftKey||e.metaKey||e.which==2){f="_blank"};if(l){console.log("Control Key: "+e.ctrlKey);console.log("Shift Key: "+e.shiftKey);console.log("Meta Key: "+e.metaKey);console.log("Which Key: "+e.which);console.log("Target: "+f)};var h=!1,r=function(){if(h){return};h=!0;window.location.href=t};if(f){if(i=="download"){if(p=="pageview"){if(!l){__gaTracker("send","pageview",t)}
7
  else{console.log("Target | Download | Send | Pageview | "+t)}}
8
- else{if(!l){__gaTracker("send","event","download",t)}
9
  else{console.log("Target | Download | Send | Event | "+t)}}}
10
- else if(i=="mailto"){if(!l){__gaTracker("send","event","mailto",t)}
11
  else{console.log("Target | Mailto | Send | Event | Mailto | "+t)}}
12
- else if(i=="internal-as-outbound"){if(!l){__gaTracker("send","event",c,t,n.title)}
13
  else{console.log("Target | Internal-As-Outbound | Send | event | "+c+" | "+t+" | "+n.title)}}
14
- else if(i=="external"){if(!l){__gaTracker("send","event","outbound-link",t,n.title)}
15
  else{console.log("Target | External | Send | 'outbound-link' | "+t+" | "+n.title)}}
16
- else{if(l){console.log("Target | "+i+" | "+t+" is not a tracked click.")}};if(l){return!1}}
17
- else{if(!e.defaultPrevented){e.preventDefault?e.preventDefault():e.returnValue=!1};if(i=="download"){if(p=="pageview"){if(!l){__gaTracker("send","pageview",t,{"hitCallback":r})}
18
  else{console.log("Not Target | Download | Send | Pageview | "+t)}}
19
- else{if(!l){__gaTracker("send","event","download",{"hitCallback":r})}
20
  else{console.log("Not Target | Download | Send | Event | "+t)}}}
21
- else if(i=="mailto"){if(!l){__gaTracker("send","event","mailto",t,{"hitCallback":r})}
22
  else{console.log("Not Target | Mailto | Send | Event | Mailto | "+t)}}
23
- else if(i=="internal-as-outbound"){window.onbeforeunload=function(e){if(!l){if(!navigator.sendBeacon){__gaTracker("send","event",c,t,n.title,{"hitCallback":r})}
24
  else{__gaTracker("send","event",c,t,n.title,{transport:"beacon"})}}
25
  else{console.log("Not Target | Internal-As-Outbound | Send | event | "+c+" | "+t+" | "+n.title)}}}
26
- else if(i=="external"){window.onbeforeunload=function(e){if(!l){if(!navigator.sendBeacon){__gaTracker("send","event","outbound-link",t,n.title,{"hitCallback":r})}
27
  else{__gaTracker("send","event","outbound-link",t,n.title,{transport:"beacon"})}}
28
  else{console.log("Not Target | External | Send | 'outbound-link' | "+t+" | "+n.title)}}}
29
- else{if(l){console.log("Not Target | "+i+" | "+t+" is not a tracked click.")}};if(l){return!1};setTimeout(r,1000)}}}};var e=window,n="click";e.addEventListener?e.addEventListener("load",function(){document.body.addEventListener(n,t,!1)},!1):e.attachEvent&&e.attachEvent("onload",function(){document.body.attachEvent("on"+n,t)})})();
 
 
1
+ (function(){function o(){var e=!1;if(monsterinsights_frontend.is_debug_mode==="true"){e=!0};var n={"is_debug_mode":e,"download_extensions":monsterinsights_frontend.download_extensions,"inbound_paths":monsterinsights_frontend.inbound_paths,"home_url":monsterinsights_frontend.home_url,"track_download_as":monsterinsights_frontend.track_download_as,"internal_label":"outbound-link-"+monsterinsights_frontend.internal_label,};return n};function t(e){var s=o(),a=s.is_debug_mode||window.monsterinsights_debug_mode,n=e.srcElement||e.target;if(a){console.log("__gaTracker.hasOwnProperty(loaded)");console.log(__gaTracker.hasOwnProperty("loaded"));console.log("__gaTracker.loaded");console.log(__gaTracker.loaded);console.log("Event.which: "+e.which);console.log("El: ");console.log(n);console.log("GA Loaded and click: "+!(!__gaTracker.hasOwnProperty("loaded")||__gaTracker.loaded!=!0||(e.which!=1&&e.which!=2&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey)))};if(!__gaTracker.hasOwnProperty("loaded")||__gaTracker.loaded!=!0||(e.which!=1&&e.which!=2&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey)){if(a){console.log("Will track: false")};return}
2
+ while(n&&(typeof n.tagName=="undefined"||n.tagName.toLowerCase()!="a"||!n.href)){n=n.parentNode};if(n&&n.href){var t=n.href,l=n.href,i="internal",m=s.download_extensions,w=s.inbound_paths,b=s.home_url,k=s.track_download_as,c="outbound-link-"+s.internal_label;if(a){console.log("Will track: true")};l=l.substring(0,(l.indexOf("#")==-1)?l.length:l.indexOf("#"));l=l.substring(0,(l.indexOf("?")==-1)?l.length:l.indexOf("?"));l=l.substring(l.lastIndexOf("/")+1,l.length);l=l.substring(l.indexOf(".")+1);var d=(function(){var t=0,e=document.domain,o=e.split("."),n="_gd"+(new Date()).getTime();while(t<(o.length-1)&&document.cookie.indexOf(n+"="+n)==-1){e=o.slice(-1-(++t)).join(".");document.cookie=n+"="+n+";domain="+e+";"};document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain="+e+";";return e})();if(typeof String.prototype.endsWith!=="function"){String.prototype.endsWith=function(e){return this.indexOf(e,this.length-e.length)!==-1}};if(typeof String.prototype.startsWith!=="function"){String.prototype.startsWith=function(e){return this.indexOf(e)===0}};if(typeof Array.prototype.includes!=="function"){Object.defineProperty(Array.prototype,"includes",{value:function(e,a){if(this==null){throw new TypeError("\"this\" is null or not defined")};var l=Object(this),o=l.length>>>0;if(o===0){return!1};var n=a|0,t=Math.max(n>=0?n:o-Math.abs(n),0);while(t<o){if(l[t]===e){return!0};t++};return!1}})};if(typeof Array.prototype.lastIndexOf!=="function"){Array.prototype.lastIndexOf=function(n){"use strict";if(this===void 0||this===null){throw new TypeError()};var e,t,l=Object(this),o=l.length>>>0;if(o===0){return-1};e=o-1;if(arguments.length>1){e=Number(arguments[1]);if(e!=e){e=0}
3
+ else if(e!=0&&e!=(1/0)&&e!=-(1/0)){e=(e>0||-1)*Math.floor(Math.abs(e))}};for(t=e>=0?Math.min(e,o-1):o-Math.abs(e);t>=0;t--){if(t in l&&l[t]===n){return t}};return-1}};function p(e){return e.replace(/^\s+|\s+$/gm,"")};if(a){console.log("Link: "+t);console.log("Extension: "+l);console.log("Protocol: "+n.protocol);console.log("External: "+(n.hostname.length>0&&d.length>0&&!n.hostname.endsWith(d)));console.log("Current domain: "+d);console.log("Link domain: "+n.hostname)};if(p(n.protocol)=="mailto"||p(n.protocol)=="mailto:"){i="mailto"}
4
+ else if(m.length>0&&l.length>0&&m.includes(l)){i="download"}
5
  else if(n.hostname.length>0&&d.length>0&&!n.hostname.endsWith(d)){i="external"}
6
+ else{var f,u,v=n.pathname;for(f=0,u=w.length;f<u;++f){if(v.startsWith(w[f])){i="internal-as-outbound";break}}};if(a){console.log("Type: "+i)};if(i!=="internal"&&!t.match(/^javascript\:/i)){var g=(n.target&&!n.target.match(/^_(self|parent|top)$/i))?n.target:!1;if(e.ctrlKey||e.shiftKey||e.metaKey||e.which==2){g="_blank"};if(a){console.log("Control Key: "+e.ctrlKey);console.log("Shift Key: "+e.shiftKey);console.log("Meta Key: "+e.metaKey);console.log("Which Key: "+e.which);console.log("Target: "+g)};var h=!1,r=function(){if(h){return};h=!0;window.location.href=t};if(g){if(i=="download"){if(k=="pageview"){if(!a){__gaTracker("send","pageview",t)}
7
  else{console.log("Target | Download | Send | Pageview | "+t)}}
8
+ else{if(!a){__gaTracker("send","event","download",t)}
9
  else{console.log("Target | Download | Send | Event | "+t)}}}
10
+ else if(i=="mailto"){if(!a){__gaTracker("send","event","mailto",t)}
11
  else{console.log("Target | Mailto | Send | Event | Mailto | "+t)}}
12
+ else if(i=="internal-as-outbound"){if(!a){__gaTracker("send","event",c,t,n.title)}
13
  else{console.log("Target | Internal-As-Outbound | Send | event | "+c+" | "+t+" | "+n.title)}}
14
+ else if(i=="external"){if(!a){__gaTracker("send","event","outbound-link",t,n.title)}
15
  else{console.log("Target | External | Send | 'outbound-link' | "+t+" | "+n.title)}}
16
+ else{if(a){console.log("Target | "+i+" | "+t+" is not a tracked click.")}}}
17
+ else{if(!e.defaultPrevented){e.preventDefault?e.preventDefault():e.returnValue=!1};if(i=="download"){if(k=="pageview"){if(!a){__gaTracker("send","pageview",t,{"hitCallback":r})}
18
  else{console.log("Not Target | Download | Send | Pageview | "+t)}}
19
+ else{if(!a){__gaTracker("send","event","download",{"hitCallback":r})}
20
  else{console.log("Not Target | Download | Send | Event | "+t)}}}
21
+ else if(i=="mailto"){if(!a){__gaTracker("send","event","mailto",t,{"hitCallback":r})}
22
  else{console.log("Not Target | Mailto | Send | Event | Mailto | "+t)}}
23
+ else if(i=="internal-as-outbound"){window.onbeforeunload=function(e){if(!a){if(!navigator.sendBeacon){__gaTracker("send","event",c,t,n.title,{"hitCallback":r})}
24
  else{__gaTracker("send","event",c,t,n.title,{transport:"beacon"})}}
25
  else{console.log("Not Target | Internal-As-Outbound | Send | event | "+c+" | "+t+" | "+n.title)}}}
26
+ else if(i=="external"){window.onbeforeunload=function(e){if(!a){if(!navigator.sendBeacon){__gaTracker("send","event","outbound-link",t,n.title,{"hitCallback":r})}
27
  else{__gaTracker("send","event","outbound-link",t,n.title,{transport:"beacon"})}}
28
  else{console.log("Not Target | External | Send | 'outbound-link' | "+t+" | "+n.title)}}}
29
+ else{if(a){console.log("Not Target | "+i+" | "+t+" is not a tracked click.")}};if(!a){setTimeout(r,1000)}
30
+ else{window.location.href=t}}}}
31
+ else{if(a){console.log("Will track: false")}}};var e=window,n="click";e.addEventListener?e.addEventListener("load",function(){document.body.addEventListener(n,t,!1)},!1):e.attachEvent&&e.attachEvent("onload",function(){document.body.attachEvent("on"+n,t)})})();
googleanalytics.php CHANGED
@@ -6,7 +6,7 @@
6
  * Author: MonsterInsights
7
  * Author URI: https://www.monsterinsights.com/
8
  *
9
- * Version: 6.0.12
10
  * Requires at least: 3.9.0
11
  * Tested up to: 4.7.3
12
  *
@@ -69,7 +69,7 @@ final class MonsterInsights_Lite {
69
  * @access public
70
  * @var string $version Plugin version.
71
  */
72
- public $version = '6.0.12';
73
 
74
  /**
75
  * Plugin file.
6
  * Author: MonsterInsights
7
  * Author URI: https://www.monsterinsights.com/
8
  *
9
+ * Version: 6.0.13
10
  * Requires at least: 3.9.0
11
  * Tested up to: 4.7.3
12
  *
69
  * @access public
70
  * @var string $version Plugin version.
71
  */
72
+ public $version = '6.0.13';
73
 
74
  /**
75
  * Plugin file.
includes/admin/google.php CHANGED
@@ -291,6 +291,8 @@ final class MonsterInsights_GA {
291
  * @return mixed
292
  */
293
  private function get_profiles_request() {
 
 
294
  $accounts = array();
295
  $start_index = 1;
296
  $paginate = false;
@@ -310,7 +312,11 @@ final class MonsterInsights_GA {
310
  'body' => json_decode( $response->getResponseBody(), true ),
311
  );
312
  } else {
313
- return esc_html__( 'Google Analytics had a connection error', 'google-analytics-for-wordpress' );
 
 
 
 
314
  }
315
 
316
  if ( isset( $response['response']['code'] ) && $response['response']['code'] == 200 ) {
@@ -351,7 +357,11 @@ final class MonsterInsights_GA {
351
  } else if ( isset( $response['response']['code'] ) && isset( $response['body']['error']['errors']['message'] ) && $response['response']['code'] !== 200 && ! $paginate ) {
352
  return $response['body']['error']['errors']['message'];
353
  } else if ( isset( $response['response']['code'] ) && $response['response']['code'] !== 200 && ! $paginate ) {
354
- return esc_html__( 'Google Analytics had a connection error', 'google-analytics-for-wordpress' );
 
 
 
 
355
  }
356
 
357
  if ( isset( $response['body']['totalResults'] ) && $start_index < $response['body']['totalResults'] && ! empty( $response['body']['nextLink'] ) ) {
291
  * @return mixed
292
  */
293
  private function get_profiles_request() {
294
+ global $wp_version;
295
+ $version = str_replace( '-src', '', $wp_version );
296
  $accounts = array();
297
  $start_index = 1;
298
  $paginate = false;
312
  'body' => json_decode( $response->getResponseBody(), true ),
313
  );
314
  } else {
315
+ if ( version_compare( $version, '4.6', '<' ) ) {
316
+ return esc_html__( 'MonsterInsights requires WordPress version 4.6 or newer to use oAuth. Please update your WordPress version.', 'google-analytics-for-wordpress' );
317
+ } else {
318
+ return esc_html__( 'Google Analytics had a connection error.', 'google-analytics-for-wordpress' );
319
+ }
320
  }
321
 
322
  if ( isset( $response['response']['code'] ) && $response['response']['code'] == 200 ) {
357
  } else if ( isset( $response['response']['code'] ) && isset( $response['body']['error']['errors']['message'] ) && $response['response']['code'] !== 200 && ! $paginate ) {
358
  return $response['body']['error']['errors']['message'];
359
  } else if ( isset( $response['response']['code'] ) && $response['response']['code'] !== 200 && ! $paginate ) {
360
+ if ( version_compare( $version, '4.6', '<' ) ) {
361
+ return esc_html__( 'MonsterInsights requires WordPress version 4.6 or newer to use oAuth. Please update your WordPress version.', 'google-analytics-for-wordpress' );
362
+ } else {
363
+ return esc_html__( 'Google Analytics had a connection error.', 'google-analytics-for-wordpress' );
364
+ }
365
  }
366
 
367
  if ( isset( $response['body']['totalResults'] ) && $start_index < $response['body']['totalResults'] && ! empty( $response['body']['nextLink'] ) ) {
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.7.3
7
- Stable tag: 6.0.12
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.
@@ -137,12 +137,16 @@ You can also learn about other <a href="http://www.wpbeginner.com/category/plugi
137
 
138
  == Changelog ==
139
 
 
 
 
 
140
  = 6.0.12, February 27, 2017 =
141
  * New: The JS events tracking has been moved to a new JS file instead of inline. This will offer the same performance as inlining under HTTP/2, but with the benefit of better cache bursting.
142
  * New: Expanded admin adblock detection.
143
  * Tweak: Select2 is now bundled as Select300 in MonsterInsights. We're pulling down the latest copy of Selct2 and then on-the-fly renaming it. This should end any conflicts between our select2 boxes and other plugins/themes.
144
  * Tweak: We've implemented better error detection on the authentication flow. Some users may have previously seen "No profile errors", due to issues with their server setup will now see more accurate errors.
145
- * Tweak: For servers that use PHP Object caching, the cache will now be flushed during the uninstall routiens. This should solve a very rare uninstall error.
146
  * Fixed: A "Invalid UA code" error was displayed whenever someone used oAuth2 and then saved the settings panel, despite having a valid UA code.
147
  * Fixed: An issue with the lazyloading of the Google Client for frontend use has been fixed.
148
 
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.7.3
7
+ Stable tag: 6.0.13
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.
137
 
138
  == Changelog ==
139
 
140
+ = 6.0.13, February 28, 2017 =
141
+ * Tweak: Better detection of issues with authentication due to an outdate WP version.
142
+ * Fixed: Issue where JS tracking inadvertantly turned on debug mode due to a bad string to boolean conversion.
143
+
144
  = 6.0.12, February 27, 2017 =
145
  * New: The JS events tracking has been moved to a new JS file instead of inline. This will offer the same performance as inlining under HTTP/2, but with the benefit of better cache bursting.
146
  * New: Expanded admin adblock detection.
147
  * Tweak: Select2 is now bundled as Select300 in MonsterInsights. We're pulling down the latest copy of Selct2 and then on-the-fly renaming it. This should end any conflicts between our select2 boxes and other plugins/themes.
148
  * Tweak: We've implemented better error detection on the authentication flow. Some users may have previously seen "No profile errors", due to issues with their server setup will now see more accurate errors.
149
+ * Tweak: For servers that use PHP Object caching, the cache will now be flushed during the uninstall routines. This should solve a very rare uninstall error.
150
  * Fixed: A "Invalid UA code" error was displayed whenever someone used oAuth2 and then saved the settings panel, despite having a valid UA code.
151
  * Fixed: An issue with the lazyloading of the Google Client for frontend use has been fixed.
152