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.4 |
Comparing to | |
See all releases |
Code changes from version 6.1.3 to 6.1.4
- assets/js/frontend.js +63 -40
- assets/js/frontend.min.js +14 -14
- googleanalytics.php +2 -2
- includes/frontend/events/class-events-js.php +1 -1
- includes/frontend/frontend.php +1 -1
- readme.txt +5 -1
assets/js/frontend.js
CHANGED
@@ -38,13 +38,18 @@ var MonsterInsights = function(){
|
|
38 |
}
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
function __gaTrackerSend ( valuesArray, fieldsArray ) {
|
42 |
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
43 |
-
fieldsArray = typeof fieldsArray !== 'undefined' ? fieldsArray :
|
44 |
|
45 |
-
|
46 |
-
__gaTracker( 'send', fieldsArray );
|
47 |
-
}
|
48 |
|
49 |
lastClicked.valuesArray = valuesArray;
|
50 |
lastClicked.fieldsArray = fieldsArray;
|
@@ -269,37 +274,47 @@ var MonsterInsights = function(){
|
|
269 |
if ( target || type == 'mailto' ) { /* If target opens a new window then just track */
|
270 |
if ( type == 'download' ) {
|
271 |
if ( track_download_as == 'pageview' ) {
|
272 |
-
fieldsArray
|
273 |
-
|
|
|
|
|
274 |
|
275 |
__gaTrackerSend( valuesArray, fieldsArray );
|
276 |
} else {
|
277 |
-
fieldsArray
|
278 |
-
|
279 |
-
|
280 |
-
|
|
|
|
|
281 |
|
282 |
__gaTrackerSend( valuesArray, fieldsArray );
|
283 |
}
|
284 |
} else if ( type == 'mailto' ) {
|
285 |
-
fieldsArray
|
286 |
-
|
287 |
-
|
288 |
-
|
|
|
|
|
289 |
|
290 |
__gaTrackerSend( valuesArray, fieldsArray );
|
291 |
} else if ( type == 'internal-as-outbound' ) {
|
292 |
-
fieldsArray
|
293 |
-
|
294 |
-
|
295 |
-
|
|
|
|
|
296 |
|
297 |
__gaTrackerSend( valuesArray, fieldsArray );
|
298 |
} else if ( type == 'external' ) {
|
299 |
-
fieldsArray
|
300 |
-
|
301 |
-
|
302 |
-
|
|
|
|
|
303 |
|
304 |
__gaTrackerSend( valuesArray, fieldsArray );
|
305 |
} else {
|
@@ -320,17 +335,21 @@ var MonsterInsights = function(){
|
|
320 |
|
321 |
if ( type == 'download' ) {
|
322 |
if ( track_download_as == 'pageview' ) {
|
323 |
-
fieldsArray
|
324 |
-
|
325 |
-
|
|
|
|
|
326 |
|
327 |
__gaTrackerSend( valuesArray, fieldsArray );
|
328 |
} else {
|
329 |
-
fieldsArray
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
|
|
|
|
334 |
|
335 |
__gaTrackerSend( valuesArray, fieldsArray );
|
336 |
}
|
@@ -344,11 +363,13 @@ var MonsterInsights = function(){
|
|
344 |
}
|
345 |
}
|
346 |
|
347 |
-
fieldsArray
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
|
|
|
|
352 |
|
353 |
if ( navigator.sendBeacon ) {
|
354 |
fieldsArray.transport = 'beacon';
|
@@ -367,11 +388,13 @@ var MonsterInsights = function(){
|
|
367 |
}
|
368 |
}
|
369 |
|
370 |
-
fieldsArray
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
|
|
|
|
375 |
|
376 |
if ( navigator.sendBeacon ) {
|
377 |
fieldsArray.transport = 'beacon';
|
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 : {};
|
51 |
|
52 |
+
__gaTracker( 'send', fieldsArray );
|
|
|
|
|
53 |
|
54 |
lastClicked.valuesArray = valuesArray;
|
55 |
lastClicked.fieldsArray = fieldsArray;
|
274 |
if ( target || type == 'mailto' ) { /* If target opens a new window then just track */
|
275 |
if ( type == 'download' ) {
|
276 |
if ( track_download_as == 'pageview' ) {
|
277 |
+
fieldsArray = {
|
278 |
+
hitType : 'pageview',
|
279 |
+
page : link,
|
280 |
+
};
|
281 |
|
282 |
__gaTrackerSend( valuesArray, fieldsArray );
|
283 |
} else {
|
284 |
+
fieldsArray = {
|
285 |
+
hitType : 'event',
|
286 |
+
eventCategory : 'download',
|
287 |
+
eventAction : link,
|
288 |
+
eventLabel : valuesArray.title,
|
289 |
+
};
|
290 |
|
291 |
__gaTrackerSend( valuesArray, fieldsArray );
|
292 |
}
|
293 |
} else if ( type == 'mailto' ) {
|
294 |
+
fieldsArray = {
|
295 |
+
hitType : 'event',
|
296 |
+
eventCategory : 'mailto',
|
297 |
+
eventAction : link,
|
298 |
+
eventLabel : valuesArray.title,
|
299 |
+
};
|
300 |
|
301 |
__gaTrackerSend( valuesArray, fieldsArray );
|
302 |
} else if ( type == 'internal-as-outbound' ) {
|
303 |
+
fieldsArray = {
|
304 |
+
hitType : 'event',
|
305 |
+
eventCategory : internal_label,
|
306 |
+
eventAction : link,
|
307 |
+
eventLabel : valuesArray.title,
|
308 |
+
};
|
309 |
|
310 |
__gaTrackerSend( valuesArray, fieldsArray );
|
311 |
} else if ( type == 'external' ) {
|
312 |
+
fieldsArray = {
|
313 |
+
hitType: 'event',
|
314 |
+
eventCategory:'outbound-link',
|
315 |
+
eventAction: link,
|
316 |
+
eventLabel: valuesArray.title,
|
317 |
+
};
|
318 |
|
319 |
__gaTrackerSend( valuesArray, fieldsArray );
|
320 |
} else {
|
335 |
|
336 |
if ( type == 'download' ) {
|
337 |
if ( track_download_as == 'pageview' ) {
|
338 |
+
fieldsArray = {
|
339 |
+
hitType : 'pageview',
|
340 |
+
page : link,
|
341 |
+
hitCallback : __gaTrackerHitBack,
|
342 |
+
};
|
343 |
|
344 |
__gaTrackerSend( valuesArray, fieldsArray );
|
345 |
} else {
|
346 |
+
fieldsArray = {
|
347 |
+
hitType : 'event',
|
348 |
+
eventCategory : 'download',
|
349 |
+
eventAction : link,
|
350 |
+
eventLabel : valuesArray.title,
|
351 |
+
hitCallback : __gaTrackerHitBack,
|
352 |
+
};
|
353 |
|
354 |
__gaTrackerSend( valuesArray, fieldsArray );
|
355 |
}
|
363 |
}
|
364 |
}
|
365 |
|
366 |
+
fieldsArray = {
|
367 |
+
hitType : 'event',
|
368 |
+
eventCategory : internal_label,
|
369 |
+
eventAction : link,
|
370 |
+
eventLabel : valuesArray.title,
|
371 |
+
hitCallback : __gaTrackerHitBack,
|
372 |
+
};
|
373 |
|
374 |
if ( navigator.sendBeacon ) {
|
375 |
fieldsArray.transport = 'beacon';
|
388 |
}
|
389 |
}
|
390 |
|
391 |
+
fieldsArray = {
|
392 |
+
hitType = 'event',
|
393 |
+
eventCategory = 'outbound-link',
|
394 |
+
eventAction = link,
|
395 |
+
eventLabel = valuesArray.title,
|
396 |
+
hitCallback = __gaTrackerHitBack,
|
397 |
+
};
|
398 |
|
399 |
if ( navigator.sendBeacon ) {
|
400 |
fieldsArray.transport = 'beacon';
|
assets/js/frontend.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
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 a(){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:
|
3 |
else if(event.which==2){return'event.which=2'}
|
4 |
else if(event.metaKey){return'metaKey'}
|
5 |
else if(event.ctrlKey){return'ctrlKey'}
|
@@ -9,20 +9,20 @@ else{return''}};function p(e){var i=h(),a=d(),n='internal',f=e.href,g=s(e.href),
|
|
9 |
else if(r(v)=='mailto'||r(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&&f.endsWith(i[t])){n='download';break}}}
|
11 |
else if(c.length>0&&u.length>0&&!c.endsWith(u)){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 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 u(
|
13 |
-
while(
|
14 |
-
else{
|
15 |
-
else if(u=='mailto'){
|
16 |
-
else if(u=='internal-as-outbound'){
|
17 |
-
else if(u=='external'){
|
18 |
else{e.exit='type';i(e)}}
|
19 |
-
else{if(u!='external'&&u!='internal-as-outbound'){if(!
|
20 |
-
else{
|
21 |
-
else{
|
22 |
-
else if(u=='internal-as-outbound'){window.onbeforeunload=function(i){if(!
|
23 |
-
else{
|
24 |
-
else if(u=='external'){window.onbeforeunload=function(i){if(!
|
25 |
-
else{
|
26 |
else{e.exit='type';i(e)};if(u!='external'&&u!='internal-as-outbound'){setTimeout(m,1000)}
|
27 |
else{if(u=='external'){setTimeout(T,1100)}
|
28 |
else{setTimeout(A,1100)}}}}}
|
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 a(){if(monsterinsights_frontend.is_debug_mode==='true'||window.monsterinsights_debug_mode){return!0}
|
2 |
+
else{return!1}};function m(e){var n={};for(var t=0;t<e.length;++t)n[t]=e[t];return n};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;o('Tracked: '+t.type);o(e)};function i(t){t=typeof t!=='undefined'?t:[];e.valuesArray=t;e.fieldsArray=[];e.tracked=!1;o('Not Tracked: '+t.exit);o(e)};function o(e){if(a()){console.dir(e)}};function r(e){return e.replace(/^\s+|\s+$/gm,'')};function l(){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 s(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 f(){return __gaTracker.hasOwnProperty('loaded')&&__gaTracker.loaded==!0};function v(){return event.which==1||event.which==2||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey};function h(){var e=[];if(typeof monsterinsights_frontend.download_extensions=='string'){e=monsterinsights_frontend.download_extensions.split(',')};return e};function d(){var e=[];if(typeof monsterinsights_frontend.inbound_paths=='string'){e=monsterinsights_frontend.inbound_paths.split(',')};return e};function g(){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'}
|
9 |
else if(r(v)=='mailto'||r(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&&f.endsWith(i[t])){n='download';break}}}
|
11 |
else if(c.length>0&&u.length>0&&!c.endsWith(u)){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 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 u(n){var o=n.srcElement||n.target,e=[],r=[];e.el=o;e.ga_loaded=f();e.click_type=g();if(!f()||!v()){e.exit='loaded';i(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=s(o.href),K=h(),L=d(),O=monsterinsights_frontend.home_url,b=monsterinsights_frontend.track_download_as,w='outbound-link-'+monsterinsights_frontend.internal_label,E=l(),u=p(o),x=y(o,n);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=a();e.download_extensions=K;e.inbound_paths=L;e.home_url=O;e.track_download_as=b;e.internal_label=w;e.link=c;e.extension=C;e.type=u;e.target=x;e.title=o.title||o.textContent||o.innerText;if(u!=='internal'&&u!=='javascript'){var k=!1,m=function(){if(k){return};k=!0;window.location.href=c},T=function(){e.exit='external';i(e)},A=function(){e.exit='internal-as-outbound';i(e)};if(x||u=='mailto'){if(u=='download'){if(b=='pageview'){r={hitType:'pageview',page:c,};t(e,r)}
|
14 |
+
else{r={hitType:'event',eventCategory:'download',eventAction:c,eventLabel:e.title,};t(e,r)}}
|
15 |
+
else if(u=='mailto'){r={hitType:'event',eventCategory:'mailto',eventAction:c,eventLabel:e.title,};t(e,r)}
|
16 |
+
else if(u=='internal-as-outbound'){r={hitType:'event',eventCategory:w,eventAction:c,eventLabel:e.title,};t(e,r)}
|
17 |
+
else if(u=='external'){r={hitType:'event',eventCategory:'outbound-link',eventAction:c,eventLabel:e.title,};t(e,r)}
|
18 |
else{e.exit='type';i(e)}}
|
19 |
+
else{if(u!='external'&&u!='internal-as-outbound'){if(!n.defaultPrevented){if(n.preventDefault){n.preventDefault()}
|
20 |
+
else{n.returnValue=!1}}};if(u=='download'){if(b=='pageview'){r={hitType:'pageview',page:c,hitCallback:m,};t(e,r)}
|
21 |
+
else{r={hitType:'event',eventCategory:'download',eventAction:c,eventLabel:e.title,hitCallback:m,};t(e,r)}}
|
22 |
+
else if(u=='internal-as-outbound'){window.onbeforeunload=function(i){if(!n.defaultPrevented){if(n.preventDefault){n.preventDefault()}
|
23 |
+
else{n.returnValue=!1}};r={hitType:'event',eventCategory:w,eventAction:c,eventLabel:e.title,hitCallback:m,};if(navigator.sendBeacon){r.transport='beacon'};t(e,r);setTimeout(m,1000)}}
|
24 |
+
else if(u=='external'){window.onbeforeunload=function(i){if(!n.defaultPrevented){if(n.preventDefault){n.preventDefault()}
|
25 |
+
else{n.returnValue=!1}};r={hitType='event',eventCategory='outbound-link',eventAction=c,eventLabel=e.title,hitCallback=m,};if(navigator.sendBeacon){r.transport='beacon'};t(e,r);setTimeout(m,1000)}}
|
26 |
else{e.exit='type';i(e)};if(u!='external'&&u!='internal-as-outbound'){setTimeout(m,1000)}
|
27 |
else{if(u=='external'){setTimeout(T,1100)}
|
28 |
else{setTimeout(A,1100)}}}}}
|
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.4
|
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.4';
|
73 |
|
74 |
/**
|
75 |
* Plugin file.
|
includes/frontend/events/class-events-js.php
CHANGED
@@ -54,7 +54,7 @@ class MonsterInsights_Events_JS {
|
|
54 |
*/
|
55 |
public function __construct() {
|
56 |
$this->base = MonsterInsights();
|
57 |
-
$tracking = monsterinsights_get_option( 'tracking_mode',
|
58 |
$events = monsterinsights_get_option( 'events_mode', false );
|
59 |
if ( $events === 'js' && $tracking === 'analytics' ) {
|
60 |
add_action( 'wp_enqueue_scripts', array( $this, 'output_javascript' ), 9 );
|
54 |
*/
|
55 |
public function __construct() {
|
56 |
$this->base = MonsterInsights();
|
57 |
+
$tracking = monsterinsights_get_option( 'tracking_mode', 'analytics' );
|
58 |
$events = monsterinsights_get_option( 'events_mode', false );
|
59 |
if ( $events === 'js' && $tracking === 'analytics' ) {
|
60 |
add_action( 'wp_enqueue_scripts', array( $this, 'output_javascript' ), 9 );
|
includes/frontend/frontend.php
CHANGED
@@ -97,7 +97,7 @@ add_action( 'wp_head', 'monsterinsights_tracking_script', 8 );
|
|
97 |
*/
|
98 |
function monsterinsights_events_tracking( ) {
|
99 |
$events_mode = monsterinsights_get_option( 'events_mode', false );
|
100 |
-
$tracking_mode = monsterinsights_get_option( 'tracking_mode',
|
101 |
$disabled_user = monsterinsights_disabled_user_group();
|
102 |
|
103 |
if ( ! $disabled_user && $events_mode === 'php' && ( $tracking_mode === 'ga' || $tracking_mode === 'analytics' ) ) {
|
97 |
*/
|
98 |
function monsterinsights_events_tracking( ) {
|
99 |
$events_mode = monsterinsights_get_option( 'events_mode', false );
|
100 |
+
$tracking_mode = monsterinsights_get_option( 'tracking_mode', 'analytics' );
|
101 |
$disabled_user = monsterinsights_disabled_user_group();
|
102 |
|
103 |
if ( ! $disabled_user && $events_mode === 'php' && ( $tracking_mode === 'ga' || $tracking_mode === 'analytics' ) ) {
|
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.1 - 6.1.3 (depending on which version of MI you have), March 22, 2017 =
|
140 |
* Bugfix: (pro users) Issue with JS events throwing an error for array on non-set settings.
|
141 |
|
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.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.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).
|
142 |
+
|
143 |
= 6.1.1 - 6.1.3 (depending on which version of MI you have), March 22, 2017 =
|
144 |
* Bugfix: (pro users) Issue with JS events throwing an error for array on non-set settings.
|
145 |
|