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 | Google Analytics for WordPress by MonsterInsights |
Version | 6.1.5 |
Comparing to | |
See all releases |
Code changes from version 6.1.4 to 6.1.5
- assets/js/frontend.js +11 -33
- assets/js/frontend.min.js +25 -25
- googleanalytics.php +2 -2
- includes/frontend/events/class-events-js.php +3 -1
- readme.txt +5 -1
assets/js/frontend.js
CHANGED
@@ -38,13 +38,6 @@ var MonsterInsights = function(){
|
|
38 |
}
|
39 |
}
|
40 |
|
41 |
-
function toObject(arr) {
|
42 |
-
var rv = {};
|
43 |
-
for (var i = 0; i < arr.length; ++i)
|
44 |
-
rv[i] = arr[i];
|
45 |
-
return rv;
|
46 |
-
}
|
47 |
-
|
48 |
function __gaTrackerSend ( valuesArray, fieldsArray ) {
|
49 |
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
50 |
fieldsArray = typeof fieldsArray !== 'undefined' ? fieldsArray : {};
|
@@ -188,7 +181,7 @@ var MonsterInsights = function(){
|
|
188 |
function __gaTrackerClickEvent( event ) {
|
189 |
var el = event.srcElement || event.target;
|
190 |
var valuesArray = [];
|
191 |
-
var fieldsArray
|
192 |
|
193 |
// Start Values Array
|
194 |
valuesArray.el = el;
|
@@ -389,11 +382,11 @@ var MonsterInsights = function(){
|
|
389 |
}
|
390 |
|
391 |
fieldsArray = {
|
392 |
-
hitType
|
393 |
-
eventCategory
|
394 |
-
eventAction
|
395 |
-
eventLabel
|
396 |
-
hitCallback
|
397 |
};
|
398 |
|
399 |
if ( navigator.sendBeacon ) {
|
@@ -425,10 +418,11 @@ var MonsterInsights = function(){
|
|
425 |
__gaTrackerNotSend( valuesArray );
|
426 |
}
|
427 |
}
|
428 |
-
|
429 |
function __gaTrackerHashChangeEvent() {
|
430 |
// Todo: Ready this section for JS unit testing
|
431 |
-
if ( monsterinsights_frontend.
|
|
|
432 |
__gaTracker('set', 'page', location.pathname + location.search + location.hash );
|
433 |
__gaTracker('send', 'pageview' );
|
434 |
__gaTrackerLog( "Hash change to: " + location.pathname + location.search + location.hash );
|
@@ -451,17 +445,7 @@ var MonsterInsights = function(){
|
|
451 |
},
|
452 |
false
|
453 |
);
|
454 |
-
|
455 |
-
"load",
|
456 |
-
function() {
|
457 |
-
document.body.addEventListener(
|
458 |
-
"hashchange",
|
459 |
-
__gaTrackerHashChangeEvent,
|
460 |
-
false
|
461 |
-
);
|
462 |
-
},
|
463 |
-
false
|
464 |
-
);
|
465 |
} else {
|
466 |
if ( __gaTrackerWindow.attachEvent ) {
|
467 |
__gaTrackerWindow.attachEvent(
|
@@ -471,13 +455,7 @@ var MonsterInsights = function(){
|
|
471 |
},
|
472 |
false
|
473 |
);
|
474 |
-
|
475 |
-
"onload",
|
476 |
-
function() {
|
477 |
-
document.body.attachEvent( "onhashchange", __gaTrackerHashChangeEvent);
|
478 |
-
},
|
479 |
-
false
|
480 |
-
);
|
481 |
}
|
482 |
}
|
483 |
|
38 |
}
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
function __gaTrackerSend ( valuesArray, fieldsArray ) {
|
42 |
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
43 |
fieldsArray = typeof fieldsArray !== 'undefined' ? fieldsArray : {};
|
181 |
function __gaTrackerClickEvent( event ) {
|
182 |
var el = event.srcElement || event.target;
|
183 |
var valuesArray = [];
|
184 |
+
var fieldsArray;
|
185 |
|
186 |
// Start Values Array
|
187 |
valuesArray.el = el;
|
382 |
}
|
383 |
|
384 |
fieldsArray = {
|
385 |
+
hitType : 'event',
|
386 |
+
eventCategory : 'outbound-link',
|
387 |
+
eventAction : link,
|
388 |
+
eventLabel : valuesArray.title,
|
389 |
+
hitCallback : __gaTrackerHitBack,
|
390 |
};
|
391 |
|
392 |
if ( navigator.sendBeacon ) {
|
418 |
__gaTrackerNotSend( valuesArray );
|
419 |
}
|
420 |
}
|
421 |
+
var prevHash = window.location.hash;
|
422 |
function __gaTrackerHashChangeEvent() {
|
423 |
// Todo: Ready this section for JS unit testing
|
424 |
+
if ( monsterinsights_frontend.hash_tracking === "true" && prevHash != window.location.hash ) {
|
425 |
+
prevHash = window.location.hash;
|
426 |
__gaTracker('set', 'page', location.pathname + location.search + location.hash );
|
427 |
__gaTracker('send', 'pageview' );
|
428 |
__gaTrackerLog( "Hash change to: " + location.pathname + location.search + location.hash );
|
445 |
},
|
446 |
false
|
447 |
);
|
448 |
+
window.addEventListener("hashchange", __gaTrackerHashChangeEvent, false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
} else {
|
450 |
if ( __gaTrackerWindow.attachEvent ) {
|
451 |
__gaTrackerWindow.attachEvent(
|
455 |
},
|
456 |
false
|
457 |
);
|
458 |
+
window.attachEvent( "onhashchange", __gaTrackerHashChangeEvent);
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
}
|
460 |
}
|
461 |
|
assets/js/frontend.min.js
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
-
;var MonsterInsights=function(){var e=[];this.setLastClicked=function(t,n,i){t=typeof t!=='undefined'?t:[];n=typeof n!=='undefined'?n:[];i=typeof i!=='undefined'?i:!1;e.valuesArray=t;e.fieldsArray=n};this.getLastClicked=function(){return e};function
|
2 |
-
else{return!1}};function
|
3 |
else if(event.which==2){return'event.which=2'}
|
4 |
else if(event.metaKey){return'metaKey'}
|
5 |
else if(event.ctrlKey){return'ctrlKey'}
|
6 |
else if(event.shiftKey){return'shiftKey'}
|
7 |
else if(event.altKey){return'altKey'}
|
8 |
-
else{return''}};function
|
9 |
-
else if(
|
10 |
-
else if(i.length>0&&g.length>0){for(t=0,o=i.length;t<o;++t){if(i[t].length>0&&
|
11 |
-
else if(c.length>0&&
|
12 |
-
else{for(t=0,o=a.length;t<o;++t){if(a[t].length>0&&p.startsWith(a[t])){n='internal-as-outbound';break}}};return n};function
|
13 |
-
while(o&&(typeof o.tagName=='undefined'||o.tagName.toLowerCase()!='a'||!o.href)){o=o.parentNode};if(o&&o.href){var c=o.href,C=
|
14 |
-
else{
|
15 |
-
else if(
|
16 |
-
else if(
|
17 |
-
else if(
|
18 |
-
else{e.exit='type';
|
19 |
-
else{if(
|
20 |
-
else{
|
21 |
-
else{
|
22 |
-
else if(
|
23 |
-
else{
|
24 |
-
else if(
|
25 |
-
else{
|
26 |
-
else{e.exit='type';
|
27 |
-
else{if(
|
28 |
else{setTimeout(A,1100)}}}}}
|
29 |
-
else{e.exit='notlink';
|
30 |
-
else{
|
31 |
-
else{if(
|
32 |
else if(t!=0&&t!=(1/0)&&t!=-(1/0)){t=(t>0||-1)*Math.floor(Math.abs(t))}};for(n=t>=0?Math.min(t,i-1):i-Math.abs(t);n>=0;n--){if(n in o&&o[n]===e){return n}};return-1}}},MonsterInsightsObject=new MonsterInsights();
|
1 |
+
;var MonsterInsights=function(){var e=[];this.setLastClicked=function(t,n,i){t=typeof t!=='undefined'?t:[];n=typeof n!=='undefined'?n:[];i=typeof i!=='undefined'?i:!1;e.valuesArray=t;e.fieldsArray=n};this.getLastClicked=function(){return e};function r(){if(monsterinsights_frontend.is_debug_mode==='true'||window.monsterinsights_debug_mode){return!0}
|
2 |
+
else{return!1}};function t(t,n){t=typeof t!=='undefined'?t:[];n=typeof n!=='undefined'?n:{};__gaTracker('send',n);e.valuesArray=t;e.fieldsArray=n;e.tracked=!0;i('Tracked: '+t.type);i(e)};function n(t){t=typeof t!=='undefined'?t:[];e.valuesArray=t;e.fieldsArray=[];e.tracked=!1;i('Not Tracked: '+t.exit);i(e)};function i(e){if(r()){console.dir(e)}};function l(e){return e.replace(/^\s+|\s+$/gm,'')};function s(){var n=0,e=document.domain,i=e.split('.'),t='_gd'+(new Date()).getTime();while(n<(i.length-1)&&document.cookie.indexOf(t+'='+t)==-1){e=i.slice(-1-(++n)).join('.');document.cookie=t+'='+t+';domain='+e+';'};document.cookie=t+'=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain='+e+';';return e};function f(e){e=e.substring(0,(e.indexOf('#')==-1)?e.length:e.indexOf('#'));e=e.substring(0,(e.indexOf('?')==-1)?e.length:e.indexOf('?'));e=e.substring(e.lastIndexOf('/')+1,e.length);e=e.substring(e.indexOf('.')+1);return e};function h(){return __gaTracker.hasOwnProperty('loaded')&&__gaTracker.loaded==!0};function g(){return event.which==1||event.which==2||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey};function d(){var e=[];if(typeof monsterinsights_frontend.download_extensions=='string'){e=monsterinsights_frontend.download_extensions.split(',')};return e};function u(){var e=[];if(typeof monsterinsights_frontend.inbound_paths=='string'){e=monsterinsights_frontend.inbound_paths.split(',')};return e};function p(){if(event.which==1){return'event.which=1'}
|
3 |
else if(event.which==2){return'event.which=2'}
|
4 |
else if(event.metaKey){return'metaKey'}
|
5 |
else if(event.ctrlKey){return'ctrlKey'}
|
6 |
else if(event.shiftKey){return'shiftKey'}
|
7 |
else if(event.altKey){return'altKey'}
|
8 |
+
else{return''}};function y(e){var i=d(),a=u(),n='internal',r=e.href,g=f(e.href),h=s(),c=e.hostname,v=e.protocol,p=e.pathname,t,o;if(r.match(/^javascript\:/i)){n='internal'}
|
9 |
+
else if(l(v)=='mailto'||l(v)=='mailto:'){n='mailto'}
|
10 |
+
else if(i.length>0&&g.length>0){for(t=0,o=i.length;t<o;++t){if(i[t].length>0&&r.endsWith(i[t])){n='download';break}}}
|
11 |
+
else if(c.length>0&&h.length>0&&!c.endsWith(h)){n='external'}
|
12 |
+
else{for(t=0,o=a.length;t<o;++t){if(a[t].length>0&&p.startsWith(a[t])){n='internal-as-outbound';break}}};return n};function m(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 o=i.srcElement||i.target,e=[],a;e.el=o;e.ga_loaded=h();e.click_type=p();if(!h()||!g()){e.exit='loaded';n(e);return}
|
13 |
+
while(o&&(typeof o.tagName=='undefined'||o.tagName.toLowerCase()!='a'||!o.href)){o=o.parentNode};if(o&&o.href){var c=o.href,C=f(o.href),K=d(),L=u(),O=monsterinsights_frontend.home_url,w=monsterinsights_frontend.track_download_as,b='outbound-link-'+monsterinsights_frontend.internal_label,E=s(),l=y(o),x=m(o,i);e.el=o;e.el_href=o.href;e.el_protocol=o.protocol;e.el_hostname=o.hostname;e.el_port=o.port;e.el_pathname=o.pathname;e.el_search=o.search;e.el_hash=o.hash;e.el_host=o.host;e.debug_mode=r();e.download_extensions=K;e.inbound_paths=L;e.home_url=O;e.track_download_as=w;e.internal_label=b;e.link=c;e.extension=C;e.type=l;e.target=x;e.title=o.title||o.textContent||o.innerText;if(l!=='internal'&&l!=='javascript'){var k=!1,v=function(){if(k){return};k=!0;window.location.href=c},T=function(){e.exit='external';n(e)},A=function(){e.exit='internal-as-outbound';n(e)};if(x||l=='mailto'){if(l=='download'){if(w=='pageview'){a={hitType:'pageview',page:c,};t(e,a)}
|
14 |
+
else{a={hitType:'event',eventCategory:'download',eventAction:c,eventLabel:e.title,};t(e,a)}}
|
15 |
+
else if(l=='mailto'){a={hitType:'event',eventCategory:'mailto',eventAction:c,eventLabel:e.title,};t(e,a)}
|
16 |
+
else if(l=='internal-as-outbound'){a={hitType:'event',eventCategory:b,eventAction:c,eventLabel:e.title,};t(e,a)}
|
17 |
+
else if(l=='external'){a={hitType:'event',eventCategory:'outbound-link',eventAction:c,eventLabel:e.title,};t(e,a)}
|
18 |
+
else{e.exit='type';n(e)}}
|
19 |
+
else{if(l!='external'&&l!='internal-as-outbound'){if(!i.defaultPrevented){if(i.preventDefault){i.preventDefault()}
|
20 |
+
else{i.returnValue=!1}}};if(l=='download'){if(w=='pageview'){a={hitType:'pageview',page:c,hitCallback:v,};t(e,a)}
|
21 |
+
else{a={hitType:'event',eventCategory:'download',eventAction:c,eventLabel:e.title,hitCallback:v,};t(e,a)}}
|
22 |
+
else if(l=='internal-as-outbound'){window.onbeforeunload=function(n){if(!i.defaultPrevented){if(i.preventDefault){i.preventDefault()}
|
23 |
+
else{i.returnValue=!1}};a={hitType:'event',eventCategory:b,eventAction:c,eventLabel:e.title,hitCallback:v,};if(navigator.sendBeacon){a.transport='beacon'};t(e,a);setTimeout(v,1000)}}
|
24 |
+
else if(l=='external'){window.onbeforeunload=function(n){if(!i.defaultPrevented){if(i.preventDefault){i.preventDefault()}
|
25 |
+
else{i.returnValue=!1}};a={hitType:'event',eventCategory:'outbound-link',eventAction:c,eventLabel:e.title,hitCallback:v,};if(navigator.sendBeacon){a.transport='beacon'};t(e,a);setTimeout(v,1000)}}
|
26 |
+
else{e.exit='type';n(e)};if(l!='external'&&l!='internal-as-outbound'){setTimeout(v,1000)}
|
27 |
+
else{if(l=='external'){setTimeout(T,1100)}
|
28 |
else{setTimeout(A,1100)}}}}}
|
29 |
+
else{e.exit='notlink';n(e)}};var a=window.location.hash;function v(){if(monsterinsights_frontend.hash_tracking==='true'&&a!=window.location.hash){a=window.location.hash;__gaTracker('set','page',location.pathname+location.search+location.hash);__gaTracker('send','pageview');i('Hash change to: '+location.pathname+location.search+location.hash)}
|
30 |
+
else{i('Hash change to (untracked): '+location.pathname+location.search+location.hash)}};var o=window;if(o.addEventListener){o.addEventListener('load',function(){document.body.addEventListener('click',c,!1)},!1);window.addEventListener('hashchange',v,!1)}
|
31 |
+
else{if(o.attachEvent){o.attachEvent('onload',function(){document.body.attachEvent('onclick',c)},!1);window.attachEvent('onhashchange',v)}};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.lastIndexOf!=='function'){Array.prototype.lastIndexOf=function(e){'use strict';if(this===void 0||this===null){throw new TypeError()};var t,n,o=Object(this),i=o.length>>>0;if(i===0){return-1};t=i-1;if(arguments.length>1){t=Number(arguments[1]);if(t!=t){t=0}
|
32 |
else if(t!=0&&t!=(1/0)&&t!=-(1/0)){t=(t>0||-1)*Math.floor(Math.abs(t))}};for(n=t>=0?Math.min(t,i-1):i-Math.abs(t);n>=0;n--){if(n in o&&o[n]===e){return n}};return-1}}},MonsterInsightsObject=new MonsterInsights();
|
googleanalytics.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Author: MonsterInsights
|
7 |
* Author URI: https://www.monsterinsights.com/
|
8 |
*
|
9 |
-
* Version: 6.1.
|
10 |
* Requires at least: 3.9.0
|
11 |
* Tested up to: 4.7.4
|
12 |
*
|
@@ -69,7 +69,7 @@ final class MonsterInsights_Lite {
|
|
69 |
* @access public
|
70 |
* @var string $version Plugin version.
|
71 |
*/
|
72 |
-
public $version = '6.1.
|
73 |
|
74 |
/**
|
75 |
* Plugin file.
|
6 |
* Author: MonsterInsights
|
7 |
* Author URI: https://www.monsterinsights.com/
|
8 |
*
|
9 |
+
* Version: 6.1.5
|
10 |
* Requires at least: 3.9.0
|
11 |
* Tested up to: 4.7.4
|
12 |
*
|
69 |
* @access public
|
70 |
* @var string $version Plugin version.
|
71 |
*/
|
72 |
+
public $version = '6.1.5';
|
73 |
|
74 |
/**
|
75 |
* Plugin file.
|
includes/frontend/events/class-events-js.php
CHANGED
@@ -124,6 +124,8 @@ class MonsterInsights_Events_JS {
|
|
124 |
$is_debug_mode = 'false';
|
125 |
}
|
126 |
|
|
|
|
|
127 |
$suffix = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
128 |
if ( ! file_exists( MONSTERINSIGHTS_PLUGIN_DIR . 'assets/js/frontend.min.js' ) ) {
|
129 |
$suffix = '';
|
@@ -140,7 +142,7 @@ class MonsterInsights_Events_JS {
|
|
140 |
'home_url' => home_url(), /* Let's get the url to compare for external/internal use */
|
141 |
'track_download_as' => $track_download_as, /* should downloads be tracked as events or pageviews */
|
142 |
'internal_label' => $internal_label, /* What is the prefix for internal-as-external links */
|
143 |
-
'hash_tracking' =>
|
144 |
)
|
145 |
);
|
146 |
}
|
124 |
$is_debug_mode = 'false';
|
125 |
}
|
126 |
|
127 |
+
$hash_tracking = monsterinsights_get_option( 'hash_tracking', false ) ? 'true' : 'false';
|
128 |
+
|
129 |
$suffix = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
130 |
if ( ! file_exists( MONSTERINSIGHTS_PLUGIN_DIR . 'assets/js/frontend.min.js' ) ) {
|
131 |
$suffix = '';
|
142 |
'home_url' => home_url(), /* Let's get the url to compare for external/internal use */
|
143 |
'track_download_as' => $track_download_as, /* should downloads be tracked as events or pageviews */
|
144 |
'internal_label' => $internal_label, /* What is the prefix for internal-as-external links */
|
145 |
+
'hash_tracking' => $hash_tracking, /* Should hash track */
|
146 |
)
|
147 |
);
|
148 |
}
|
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.4
|
7 |
-
Stable tag: 6.1.
|
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,6 +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.1.4, March 23, 2017 =
|
140 |
* Tweak: JS events tracking for click events.
|
141 |
* Bugfix: Edge case where JS events tracking won't turn on if the main tracking setting was disabled (such as faulty import).
|
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.4
|
7 |
+
Stable tag: 6.1.5
|
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.1.5, March 24, 2017 =
|
140 |
+
* New: Added some functions to prepare for upcoming new addon (Google AMP) and updates (eCommerce, Performance, Dimensions).
|
141 |
+
* Tweak: Ks events tracking for click events.
|
142 |
+
|
143 |
= 6.1.4, March 23, 2017 =
|
144 |
* Tweak: JS events tracking for click events.
|
145 |
* Bugfix: Edge case where JS events tracking won't turn on if the main tracking setting was disabled (such as faulty import).
|