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.0.14 |
Comparing to | |
See all releases |
Code changes from version 6.0.13 to 6.0.14
- assets/js/frontend.js +14 -3
- assets/js/frontend.min.js +18 -18
- googleanalytics.php +2 -2
- includes/admin/licensing/license.php +1 -1
- includes/admin/settings/tab-general.php +3 -1
- includes/frontend/events/class-events-js.php +5 -12
- readme.txt +7 -1
assets/js/frontend.js
CHANGED
@@ -20,10 +20,21 @@
|
|
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' :
|
26 |
-
'inbound_paths' :
|
27 |
'home_url' : monsterinsights_frontend.home_url, /* Let's get the url to compare for external/internal use */
|
28 |
'track_download_as' : monsterinsights_frontend.track_download_as, /* should downloads be tracked as events or pageviews */
|
29 |
'internal_label' : "outbound-link-" + monsterinsights_frontend.internal_label, /* What is the prefix for internal-as-external links */
|
@@ -78,7 +89,7 @@
|
|
78 |
var inbound_paths = phpvalues.inbound_paths; /* Let's get the internal paths to track */
|
79 |
var home_url = phpvalues.home_url; /* Let's get the url to compare for external/internal use */
|
80 |
var track_download_as = phpvalues.track_download_as; /* should downloads be tracked as events or pageviews */
|
81 |
-
var internal_label =
|
82 |
|
83 |
if ( is_debug_mode ) {
|
84 |
console.log( "Will track: true");
|
20 |
if ( monsterinsights_frontend.is_debug_mode === "true" ) {
|
21 |
debug_mode = true;
|
22 |
}
|
23 |
+
|
24 |
+
var inbound_paths = [];
|
25 |
+
var download_extensions = [];
|
26 |
+
|
27 |
+
if ( typeof monsterinsights_frontend.download_extensions == 'string' ) {
|
28 |
+
download_extensions = monsterinsights_frontend.download_extensions.split(",");
|
29 |
+
}
|
30 |
+
if ( typeof monsterinsights_frontend.inbound_paths == 'string' ) {
|
31 |
+
inbound_paths = monsterinsights_frontend.inbound_paths.split(",");
|
32 |
+
}
|
33 |
+
|
34 |
var phpvalues = {
|
35 |
'is_debug_mode' : debug_mode,
|
36 |
+
'download_extensions' : download_extensions, /* Let's get the extensions to track */
|
37 |
+
'inbound_paths' : inbound_paths, /* Let's get the internal paths to track */
|
38 |
'home_url' : monsterinsights_frontend.home_url, /* Let's get the url to compare for external/internal use */
|
39 |
'track_download_as' : monsterinsights_frontend.track_download_as, /* should downloads be tracked as events or pageviews */
|
40 |
'internal_label' : "outbound-link-" + monsterinsights_frontend.internal_label, /* What is the prefix for internal-as-external links */
|
89 |
var inbound_paths = phpvalues.inbound_paths; /* Let's get the internal paths to track */
|
90 |
var home_url = phpvalues.home_url; /* Let's get the url to compare for external/internal use */
|
91 |
var track_download_as = phpvalues.track_download_as; /* should downloads be tracked as events or pageviews */
|
92 |
+
var internal_label = phpvalues.internal_label; /* What is the prefix for internal-as-external links */
|
93 |
|
94 |
if ( is_debug_mode ) {
|
95 |
console.log( "Will track: true");
|
assets/js/frontend.min.js
CHANGED
@@ -1,31 +1,31 @@
|
|
1 |
-
(function(){function o(){var
|
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,
|
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
|
4 |
-
else if(m.length>0&&l.length>0&&m.includes(l)){
|
5 |
-
else if(n.hostname.length>0&&d.length>0&&!n.hostname.endsWith(d)){
|
6 |
-
else{var f,u,
|
7 |
else{console.log("Target | Download | Send | Pageview | "+t)}}
|
8 |
-
else{if(!
|
9 |
else{console.log("Target | Download | Send | Event | "+t)}}}
|
10 |
-
else if(
|
11 |
else{console.log("Target | Mailto | Send | Event | Mailto | "+t)}}
|
12 |
-
else if(
|
13 |
else{console.log("Target | Internal-As-Outbound | Send | event | "+c+" | "+t+" | "+n.title)}}
|
14 |
-
else if(
|
15 |
else{console.log("Target | External | Send | 'outbound-link' | "+t+" | "+n.title)}}
|
16 |
-
else{if(
|
17 |
-
else{if(!e.defaultPrevented){e.preventDefault?e.preventDefault():e.returnValue=!1};if(
|
18 |
else{console.log("Not Target | Download | Send | Pageview | "+t)}}
|
19 |
-
else{if(!
|
20 |
else{console.log("Not Target | Download | Send | Event | "+t)}}}
|
21 |
-
else if(
|
22 |
else{console.log("Not Target | Mailto | Send | Event | Mailto | "+t)}}
|
23 |
-
else if(
|
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(
|
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(
|
30 |
else{window.location.href=t}}}}
|
31 |
-
else{if(
|
1 |
+
(function(){function o(){var t=!1;if(monsterinsights_frontend.is_debug_mode==="true"){t=!0};var e=[],n=[];if(typeof monsterinsights_frontend.download_extensions=="string"){n=monsterinsights_frontend.download_extensions.split(",")};if(typeof monsterinsights_frontend.inbound_paths=="string"){e=monsterinsights_frontend.inbound_paths.split(",")};var o={"is_debug_mode":t,"download_extensions":n,"inbound_paths":e,"home_url":monsterinsights_frontend.home_url,"track_download_as":monsterinsights_frontend.track_download_as,"internal_label":"outbound-link-"+monsterinsights_frontend.internal_label,};return o};function t(e){var s=o(),i=s.is_debug_mode||window.monsterinsights_debug_mode,n=e.srcElement||e.target;if(i){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(i){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,a="internal",m=s.download_extensions,p=s.inbound_paths,y=s.home_url,w=s.track_download_as,c=s.internal_label;if(i){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,i){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=i|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 v(e){return e.replace(/^\s+|\s+$/gm,"")};if(i){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(v(n.protocol)=="mailto"||v(n.protocol)=="mailto:"){a="mailto"}
|
4 |
+
else if(m.length>0&&l.length>0&&m.includes(l)){a="download"}
|
5 |
+
else if(n.hostname.length>0&&d.length>0&&!n.hostname.endsWith(d)){a="external"}
|
6 |
+
else{var f,u,k=n.pathname;for(f=0,u=p.length;f<u;++f){if(k.startsWith(p[f])){a="internal-as-outbound";break}}};if(i){console.log("Type: "+a)};if(a!=="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(i){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(a=="download"){if(w=="pageview"){if(!i){__gaTracker("send","pageview",t)}
|
7 |
else{console.log("Target | Download | Send | Pageview | "+t)}}
|
8 |
+
else{if(!i){__gaTracker("send","event","download",t)}
|
9 |
else{console.log("Target | Download | Send | Event | "+t)}}}
|
10 |
+
else if(a=="mailto"){if(!i){__gaTracker("send","event","mailto",t)}
|
11 |
else{console.log("Target | Mailto | Send | Event | Mailto | "+t)}}
|
12 |
+
else if(a=="internal-as-outbound"){if(!i){__gaTracker("send","event",c,t,n.title)}
|
13 |
else{console.log("Target | Internal-As-Outbound | Send | event | "+c+" | "+t+" | "+n.title)}}
|
14 |
+
else if(a=="external"){if(!i){__gaTracker("send","event","outbound-link",t,n.title)}
|
15 |
else{console.log("Target | External | Send | 'outbound-link' | "+t+" | "+n.title)}}
|
16 |
+
else{if(i){console.log("Target | "+a+" | "+t+" is not a tracked click.")}}}
|
17 |
+
else{if(!e.defaultPrevented){e.preventDefault?e.preventDefault():e.returnValue=!1};if(a=="download"){if(w=="pageview"){if(!i){__gaTracker("send","pageview",t,{"hitCallback":r})}
|
18 |
else{console.log("Not Target | Download | Send | Pageview | "+t)}}
|
19 |
+
else{if(!i){__gaTracker("send","event","download",{"hitCallback":r})}
|
20 |
else{console.log("Not Target | Download | Send | Event | "+t)}}}
|
21 |
+
else if(a=="mailto"){if(!i){__gaTracker("send","event","mailto",t,{"hitCallback":r})}
|
22 |
else{console.log("Not Target | Mailto | Send | Event | Mailto | "+t)}}
|
23 |
+
else if(a=="internal-as-outbound"){window.onbeforeunload=function(e){if(!i){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(a=="external"){window.onbeforeunload=function(e){if(!i){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(i){console.log("Not Target | "+a+" | "+t+" is not a tracked click.")}};if(!i){setTimeout(r,1000)}
|
30 |
else{window.location.href=t}}}}
|
31 |
+
else{if(i){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.
|
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.
|
73 |
|
74 |
/**
|
75 |
* Plugin file.
|
6 |
* Author: MonsterInsights
|
7 |
* Author URI: https://www.monsterinsights.com/
|
8 |
*
|
9 |
+
* Version: 6.0.14
|
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.14';
|
73 |
|
74 |
/**
|
75 |
* Plugin file.
|
includes/admin/licensing/license.php
CHANGED
@@ -347,7 +347,7 @@ final class MonsterInsights_License {
|
|
347 |
}
|
348 |
|
349 |
// If an error is returned, set the error and return.
|
350 |
-
if ( ! empty( $deactivate->error ) ) {
|
351 |
$this->errors[] = $deactivate->error;
|
352 |
return;
|
353 |
}
|
347 |
}
|
348 |
|
349 |
// If an error is returned, set the error and return.
|
350 |
+
if ( ! empty( $deactivate->error ) && ! monsterinsights_is_debug_mode() ) {
|
351 |
$this->errors[] = $deactivate->error;
|
352 |
return;
|
353 |
}
|
includes/admin/settings/tab-general.php
CHANGED
@@ -261,7 +261,9 @@ function monsterinsights_settings_save_general() {
|
|
261 |
}
|
262 |
|
263 |
$anonymous_data = isset( $_POST['anonymous_data'] ) ? 1 : 0;
|
264 |
-
|
|
|
|
|
265 |
|
266 |
/**
|
267 |
* Developer Alert:
|
261 |
}
|
262 |
|
263 |
$anonymous_data = isset( $_POST['anonymous_data'] ) ? 1 : 0;
|
264 |
+
if ( $anonymous_data ) {
|
265 |
+
monsterinsights_update_option( 'anonymous_data', $anonymous_data );
|
266 |
+
}
|
267 |
|
268 |
/**
|
269 |
* Developer Alert:
|
includes/frontend/events/class-events-js.php
CHANGED
@@ -95,14 +95,11 @@ class MonsterInsights_Events_JS {
|
|
95 |
|
96 |
$i = 0;
|
97 |
foreach ( $inbound_paths as $path ){
|
98 |
-
$inbound_paths[ $i ] =
|
99 |
$i++;
|
100 |
}
|
101 |
|
102 |
-
$inbound_paths =
|
103 |
-
if ( $inbound_paths === '[""]' ) {
|
104 |
-
$inbound_paths = "[]";
|
105 |
-
}
|
106 |
|
107 |
// Get download extensions to track
|
108 |
$download_extensions = monsterinsights_get_option( 'extensions_of_files', '' );
|
@@ -110,14 +107,11 @@ class MonsterInsights_Events_JS {
|
|
110 |
|
111 |
$i = 0;
|
112 |
foreach( $download_extensions as $extension ){
|
113 |
-
$download_extensions[ $i ] =
|
114 |
$i++;
|
115 |
}
|
116 |
|
117 |
-
$download_extensions =
|
118 |
-
if ( $download_extensions === '[""]' ) {
|
119 |
-
$download_extensions = "[]";
|
120 |
-
}
|
121 |
|
122 |
$track_download_as = monsterinsights_get_option( 'track_download_as', '' );
|
123 |
$track_download_as = $track_download_as === 'pageview' ? 'pageview' : 'event';
|
@@ -138,14 +132,13 @@ class MonsterInsights_Events_JS {
|
|
138 |
MONSTERINSIGHTS_PLUGIN_SLUG . '-frontend-script',
|
139 |
'monsterinsights_frontend',
|
140 |
array(
|
141 |
-
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
142 |
'js_events_tracking' => 'true',
|
143 |
'is_debug_mode' => $is_debug_mode,
|
144 |
'download_extensions' => $download_extensions, /* Let's get the extensions to track */
|
145 |
'inbound_paths' => $inbound_paths, /* Let's get the internal paths to track */
|
146 |
'home_url' => home_url(), /* Let's get the url to compare for external/internal use */
|
147 |
'track_download_as' => $track_download_as, /* should downloads be tracked as events or pageviews */
|
148 |
-
'internal_label' =>
|
149 |
)
|
150 |
);
|
151 |
}
|
95 |
|
96 |
$i = 0;
|
97 |
foreach ( $inbound_paths as $path ){
|
98 |
+
$inbound_paths[ $i ] = esc_js( trim( $path ) );
|
99 |
$i++;
|
100 |
}
|
101 |
|
102 |
+
$inbound_paths = implode( ",", $inbound_paths );
|
|
|
|
|
|
|
103 |
|
104 |
// Get download extensions to track
|
105 |
$download_extensions = monsterinsights_get_option( 'extensions_of_files', '' );
|
107 |
|
108 |
$i = 0;
|
109 |
foreach( $download_extensions as $extension ){
|
110 |
+
$download_extensions[ $i ] = esc_js( trim( $extension ) );
|
111 |
$i++;
|
112 |
}
|
113 |
|
114 |
+
$download_extensions = implode( ",", $download_extensions );
|
|
|
|
|
|
|
115 |
|
116 |
$track_download_as = monsterinsights_get_option( 'track_download_as', '' );
|
117 |
$track_download_as = $track_download_as === 'pageview' ? 'pageview' : 'event';
|
132 |
MONSTERINSIGHTS_PLUGIN_SLUG . '-frontend-script',
|
133 |
'monsterinsights_frontend',
|
134 |
array(
|
|
|
135 |
'js_events_tracking' => 'true',
|
136 |
'is_debug_mode' => $is_debug_mode,
|
137 |
'download_extensions' => $download_extensions, /* Let's get the extensions to track */
|
138 |
'inbound_paths' => $inbound_paths, /* Let's get the internal paths to track */
|
139 |
'home_url' => home_url(), /* Let's get the url to compare for external/internal use */
|
140 |
'track_download_as' => $track_download_as, /* should downloads be tracked as events or pageviews */
|
141 |
+
'internal_label' => $internal_label, /* What is the prefix for internal-as-external links */
|
142 |
)
|
143 |
);
|
144 |
}
|
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.
|
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,6 +137,12 @@ You can also learn about other <a href="http://www.wpbeginner.com/category/plugi
|
|
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.
|
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.14
|
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.14, March 1, 2017 =
|
141 |
+
* Tweak: Allow for invalid license to be removed if debug turned on.
|
142 |
+
* Fixed: Issues with internal links being tracked as internal-as-outbound
|
143 |
+
* Fixed: Issues with tracking of downloads
|
144 |
+
* Fixed: Issue where optin tracking would opt-out on settings panel save
|
145 |
+
|
146 |
= 6.0.13, February 28, 2017 =
|
147 |
* Tweak: Better detection of issues with authentication due to an outdate WP version.
|
148 |
* Fixed: Issue where JS tracking inadvertantly turned on debug mode due to a bad string to boolean conversion.
|