Google Analytics for WordPress by MonsterInsights - Version 7.0.3

Version Description

= 7.0.0 =

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

= 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 7.0.3
Comparing to
See all releases

Code changes from version 7.0.2 to 7.0.3

assets/js/frontend.js CHANGED
@@ -169,7 +169,7 @@ var MonsterInsights = function(){
169
 
170
  if ( type === 'unknown' && download_extensions.length > 0 && extension.length > 0 ) { /* If it's a download */
171
  for ( index = 0, len = download_extensions.length; index < len; ++index ) {
172
- if ( download_extensions[ index ].length > 0 && link.endsWith( download_extensions[ index ] ) ) {
173
  type = "download";
174
  break;
175
  }
169
 
170
  if ( type === 'unknown' && download_extensions.length > 0 && extension.length > 0 ) { /* If it's a download */
171
  for ( index = 0, len = download_extensions.length; index < len; ++index ) {
172
+ if ( download_extensions[ index ].length > 0 && ( link.endsWith( download_extensions[ index ] ) || download_extensions[ index ] == extension ) ) {
173
  type = "download";
174
  break;
175
  }
assets/js/frontend.min.js CHANGED
@@ -6,12 +6,12 @@ else if(e.metaKey){return'metaKey'}
6
  else if(e.ctrlKey){return'ctrlKey'}
7
  else if(e.shiftKey){return'shiftKey'}
8
  else if(e.altKey){return'altKey'}
9
- else{return''}};function m(e){var i=d(),o=u(),t='unknown',c=e.href,v=f(e.href),g=s(),r=e.hostname,l=e.protocol,p=e.pathname,n,h;if(c.match(/^javascript\:/i)){t='internal'}
10
  else if(a(l)=='tel'||a(l)=='tel:'){t='tel'}
11
  else if(a(l)=='mailto'||a(l)=='mailto:'){t='mailto'}
12
- else if(r.length>0&&g.length>0&&!r.endsWith(g)){t='external'}
13
- else if(o.length>0&&p.length>0){for(n=0,h=o.length;n<h;++n){if(o[n].length>0&&p.startsWith(o[n])){t='internal-as-outbound';break}}}
14
- else if(window.monsterinsights_experimental_mode&&r.length>0&&document.domain.length>0&&r!==document.domain){t='cross-hostname'};if(t==='unknown'&&i.length>0&&v.length>0){for(n=0,h=i.length;n<h;++n){if(i[n].length>0&&c.endsWith(i[n])){t='download';break}}};if(t==='unknown'){t='internal'};return t};function y(e,t){var n=(e.target&&!e.target.match(/^_(self|parent|top)$/i))?e.target:!1;if(t.ctrlKey||t.shiftKey||t.metaKey||t.which==2){n='_blank'};return n};function c(i){var a=i.srcElement||i.target,t=[],o;t.el=a;t.ga_loaded=h();t.click_type=v(i);if(!h()||!p(i)){t.exit='loaded';n(t);return}
15
  while(a&&(typeof a.tagName=='undefined'||a.tagName.toLowerCase()!='a'||!a.href)){a=a.parentNode};if(a&&a.href){var c=a.href,A=f(a.href),L=d(),K=u(),O=monsterinsights_frontend.home_url,w=monsterinsights_frontend.track_download_as,b='outbound-link-'+monsterinsights_frontend.internal_label,E=s(),r=m(a),x=y(a,i);t.el=a;t.el_href=a.href;t.el_protocol=a.protocol;t.el_hostname=a.hostname;t.el_port=a.port;t.el_pathname=a.pathname;t.el_search=a.search;t.el_hash=a.hash;t.el_host=a.host;t.debug_mode=l();t.download_extensions=L;t.inbound_paths=K;t.home_url=O;t.track_download_as=w;t.internal_label=b;t.link=c;t.extension=A;t.type=r;t.target=x;t.title=a.title||a.textContent||a.innerText;if(r!=='internal'&&r!=='javascript'){var k=!1,g=function(){if(k){return};k=!0;window.location.href=c},T=function(){t.exit='external';n(t)},C=function(){t.exit='internal-as-outbound';n(t)};if(x||r=='mailto'||r=='tel'){if(r=='download'){if(w=='pageview'){o={hitType:'pageview',page:c,};e(t,o)}
16
  else{o={hitType:'event',eventCategory:'download',eventAction:c,eventLabel:t.title,};e(t,o)}}
17
  else if(r=='tel'){o={hitType:'event',eventCategory:'tel',eventAction:c,eventLabel:t.title.replace('tel:',''),};e(t,o)}
6
  else if(e.ctrlKey){return'ctrlKey'}
7
  else if(e.shiftKey){return'shiftKey'}
8
  else if(e.altKey){return'altKey'}
9
+ else{return''}};function m(e){var i=d(),o=u(),t='unknown',c=e.href,g=f(e.href),p=s(),r=e.hostname,l=e.protocol,v=e.pathname,n,h;if(c.match(/^javascript\:/i)){t='internal'}
10
  else if(a(l)=='tel'||a(l)=='tel:'){t='tel'}
11
  else if(a(l)=='mailto'||a(l)=='mailto:'){t='mailto'}
12
+ else if(r.length>0&&p.length>0&&!r.endsWith(p)){t='external'}
13
+ else if(o.length>0&&v.length>0){for(n=0,h=o.length;n<h;++n){if(o[n].length>0&&v.startsWith(o[n])){t='internal-as-outbound';break}}}
14
+ else if(window.monsterinsights_experimental_mode&&r.length>0&&document.domain.length>0&&r!==document.domain){t='cross-hostname'};if(t==='unknown'&&i.length>0&&g.length>0){for(n=0,h=i.length;n<h;++n){if(i[n].length>0&&(c.endsWith(i[n])||i[n]==g)){t='download';break}}};if(t==='unknown'){t='internal'};return t};function y(e,t){var n=(e.target&&!e.target.match(/^_(self|parent|top)$/i))?e.target:!1;if(t.ctrlKey||t.shiftKey||t.metaKey||t.which==2){n='_blank'};return n};function c(i){var a=i.srcElement||i.target,t=[],o;t.el=a;t.ga_loaded=h();t.click_type=v(i);if(!h()||!p(i)){t.exit='loaded';n(t);return}
15
  while(a&&(typeof a.tagName=='undefined'||a.tagName.toLowerCase()!='a'||!a.href)){a=a.parentNode};if(a&&a.href){var c=a.href,A=f(a.href),L=d(),K=u(),O=monsterinsights_frontend.home_url,w=monsterinsights_frontend.track_download_as,b='outbound-link-'+monsterinsights_frontend.internal_label,E=s(),r=m(a),x=y(a,i);t.el=a;t.el_href=a.href;t.el_protocol=a.protocol;t.el_hostname=a.hostname;t.el_port=a.port;t.el_pathname=a.pathname;t.el_search=a.search;t.el_hash=a.hash;t.el_host=a.host;t.debug_mode=l();t.download_extensions=L;t.inbound_paths=K;t.home_url=O;t.track_download_as=w;t.internal_label=b;t.link=c;t.extension=A;t.type=r;t.target=x;t.title=a.title||a.textContent||a.innerText;if(r!=='internal'&&r!=='javascript'){var k=!1,g=function(){if(k){return};k=!0;window.location.href=c},T=function(){t.exit='external';n(t)},C=function(){t.exit='internal-as-outbound';n(t)};if(x||r=='mailto'||r=='tel'){if(r=='download'){if(w=='pageview'){o={hitType:'pageview',page:c,};e(t,o)}
16
  else{o={hitType:'event',eventCategory:'download',eventAction:c,eventLabel:t.title,};e(t,o)}}
17
  else if(r=='tel'){o={hitType:'event',eventCategory:'tel',eventAction:c,eventLabel:t.title.replace('tel:',''),};e(t,o)}
googleanalytics.php CHANGED
@@ -6,7 +6,7 @@
6
  * Author: MonsterInsights
7
  * Author URI: https://www.monsterinsights.com/
8
  *
9
- * Version: 7.0.2
10
  * Requires at least: 3.8.0
11
  * Tested up to: 4.9
12
  *
@@ -69,7 +69,7 @@ final class MonsterInsights_Lite {
69
  * @access public
70
  * @var string $version Plugin version.
71
  */
72
- public $version = '7.0.2';
73
 
74
  /**
75
  * Plugin file.
6
  * Author: MonsterInsights
7
  * Author URI: https://www.monsterinsights.com/
8
  *
9
+ * Version: 7.0.3
10
  * Requires at least: 3.8.0
11
  * Tested up to: 4.9
12
  *
69
  * @access public
70
  * @var string $version Plugin version.
71
  */
72
+ public $version = '7.0.3';
73
 
74
  /**
75
  * Plugin file.
includes/admin/tracking.php CHANGED
@@ -52,6 +52,15 @@ class MonsterInsights_Tracking {
52
  $update_mode = 'none';
53
  }
54
 
 
 
 
 
 
 
 
 
 
55
  $data['php_version'] = phpversion();
56
  $data['mi_version'] = MONSTERINSIGHTS_VERSION;
57
  $data['wp_version'] = get_bloginfo( 'version' );
@@ -69,9 +78,9 @@ class MonsterInsights_Tracking {
69
  $data['events_mode'] = $events_mode;
70
  $data['autoupdate'] = $update_mode;
71
  $data['pro'] = (int) monsterinsights_is_pro_version();
72
- $data['sites'] = is_multisite() ? (int) get_blog_count() : 1;
73
  $data['usagetracking'] = get_option( 'monsterinsights_usage_tracking_config', $tracking );
74
- $data['usercount'] = get_user_count();
75
 
76
  // Retrieve current plugin information
77
  if( ! function_exists( 'get_plugins' ) ) {
52
  $update_mode = 'none';
53
  }
54
 
55
+ $count_b = 1;
56
+ if ( is_multisite() ) {
57
+ if ( function_exists( 'get_blog_count' ) ) {
58
+ $count_b = get_blog_count();
59
+ } else {
60
+ $count_b = 'Not Set';
61
+ }
62
+ }
63
+
64
  $data['php_version'] = phpversion();
65
  $data['mi_version'] = MONSTERINSIGHTS_VERSION;
66
  $data['wp_version'] = get_bloginfo( 'version' );
78
  $data['events_mode'] = $events_mode;
79
  $data['autoupdate'] = $update_mode;
80
  $data['pro'] = (int) monsterinsights_is_pro_version();
81
+ $data['sites'] = $count_b;
82
  $data['usagetracking'] = get_option( 'monsterinsights_usage_tracking_config', $tracking );
83
+ $data['usercount'] = function_exists( 'get_user_count' ) ? get_user_count() : 'Not Set';
84
 
85
  // Retrieve current plugin information
86
  if( ! function_exists( 'get_plugins' ) ) {
includes/frontend/tracking/class-tracking-analytics.php CHANGED
@@ -204,8 +204,8 @@ class MonsterInsights_Tracking_Analytics extends MonsterInsights_Tracking_Abstra
204
  } ?>
205
  <?php if ( $ua ) { ?>
206
  <script type="text/javascript" data-cfasync="false">
207
- <?php if ( $this->should_do_optout() ) { ?>
208
  var mi_track_user = <?php echo ( $track_user ? 'true' : 'false' ); ?>;
 
209
  var disableStr = 'ga-disable-<?php echo monsterinsights_get_ua(); ?>';
210
 
211
  /* Function to detect opted out users */
@@ -249,7 +249,8 @@ class MonsterInsights_Tracking_Analytics extends MonsterInsights_Tracking_Abstra
249
  }
250
  ?>
251
  } else {
252
- console.log( '%c' + "<?php echo esc_js( $reason );?>", 'color:#F74C2F;font-size: 1.5em;font-weight:800;');
 
253
  (function() {
254
  /* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */
255
  var noopfn = function() {
@@ -291,6 +292,7 @@ class MonsterInsights_Tracking_Analytics extends MonsterInsights_Tracking_Abstra
291
  __gaTracker.remove = noopfn;
292
  window['__gaTracker'] = __gaTracker;
293
  })();
 
294
  }
295
  </script>
296
  <?php } else { ?>
204
  } ?>
205
  <?php if ( $ua ) { ?>
206
  <script type="text/javascript" data-cfasync="false">
 
207
  var mi_track_user = <?php echo ( $track_user ? 'true' : 'false' ); ?>;
208
+ <?php if ( $this->should_do_optout() ) { ?>
209
  var disableStr = 'ga-disable-<?php echo monsterinsights_get_ua(); ?>';
210
 
211
  /* Function to detect opted out users */
249
  }
250
  ?>
251
  } else {
252
+ <?php if ( $this->should_do_optout() ) { ?>
253
+ console.log( "<?php echo esc_js( $reason );?>" );
254
  (function() {
255
  /* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */
256
  var noopfn = function() {
292
  __gaTracker.remove = noopfn;
293
  window['__gaTracker'] = __gaTracker;
294
  })();
295
+ <?php } ?>
296
  }
297
  </script>
298
  <?php } else { ?>
includes/helpers.php CHANGED
@@ -46,7 +46,7 @@ function monsterinsights_track_user() {
46
  }
47
 
48
  $track_super_admin = apply_filters( 'monsterinsights_track_super_admins', false );
49
- if ( $track_super_admin === false && is_super_admin() ) {
50
  $track_user = false;
51
  }
52
 
46
  }
47
 
48
  $track_super_admin = apply_filters( 'monsterinsights_track_super_admins', false );
49
+ if ( $track_super_admin === false && is_multisite() && is_super_admin() ) {
50
  $track_user = false;
51
  }
52
 
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.8.0
6
  Tested up to: 4.9
7
- Stable tag: 7.0.2
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.
@@ -134,6 +134,15 @@ You can also learn about other <a href="http://www.wpbeginner.com/category/plugi
134
  4. Want more features? <a href="https://www.monsterinsights.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion">Purchase MonsterInsights Pro</a>!
135
 
136
  == Changelog ==
 
 
 
 
 
 
 
 
 
137
  = 7.0.2: February 27, 2018 =
138
  - Bugfix: Fixed a bug with the analytics.js output where a UA code wasn't entered, the $reason variable could be undefined.
139
  - Bugfix: Fixed an issue where a notice might not be dismissable and we've also removed several of them.
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.8.0
6
  Tested up to: 4.9
7
+ Stable tag: 7.0.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.
134
  4. Want more features? <a href="https://www.monsterinsights.com/?utm_source=wprepo&utm_medium=link&utm_campaign=liteversion">Purchase MonsterInsights Pro</a>!
135
 
136
  == Changelog ==
137
+
138
+ = 7.0.3: February 28, 2018 =
139
+ - New: We added support for tracking download files that have a cache busting variable on the URL.
140
+ - New: We added support for the new UserID mode used in our AMP addon.
141
+ - Tweak: We fixed a bug with the notices class, and drastically cut back on the number of them.
142
+ - Bugfix: We fixed a bug with our Facebook Instant Articles addon that prevented some users from being tracked for downloads.
143
+ - Bugfix: We fixed a bug in the usage tracking for some types of installs.
144
+ - Bugfix: We've allowed the disabling of tracking for admininistrator role users on single sites.
145
+
146
  = 7.0.2: February 27, 2018 =
147
  - Bugfix: Fixed a bug with the analytics.js output where a UA code wasn't entered, the $reason variable could be undefined.
148
  - Bugfix: Fixed an issue where a notice might not be dismissable and we've also removed several of them.