Version Description
Download this release
Release Info
Developer | yuvalo |
Plugin | WP Google Analytics Events |
Version | 2.6.2 |
Comparing to | |
See all releases |
Code changes from version 2.6.1 to 2.6.2
- ga-scroll-event.php +2 -2
- js/dist/frontend-scripts-min.js +1 -1
- js/dist/frontend-scripts.js +11 -1
- js/main.js +13 -3
- readme.txt +4 -1
ga-scroll-event.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: WP Google Analytics Events
|
5 |
Plugin URI: http://wpflow.com
|
6 |
Description: Adds the Google Analytics code to your website and enables you to send events on scroll or click.
|
7 |
-
Version: 2.6.
|
8 |
Author: PineWise
|
9 |
Author URI: http://wpflow.com
|
10 |
License: GPLv2
|
@@ -29,7 +29,7 @@ plugin_dir_url(__FILE__));
|
|
29 |
// Current version number
|
30 |
if (!defined('GA_EVENTS_VERSION'))
|
31 |
define('GA_EVENTS_VERSION',
|
32 |
-
'2.6.
|
33 |
|
34 |
// Dependencies
|
35 |
|
4 |
Plugin Name: WP Google Analytics Events
|
5 |
Plugin URI: http://wpflow.com
|
6 |
Description: Adds the Google Analytics code to your website and enables you to send events on scroll or click.
|
7 |
+
Version: 2.6.2
|
8 |
Author: PineWise
|
9 |
Author URI: http://wpflow.com
|
10 |
License: GPLv2
|
29 |
// Current version number
|
30 |
if (!defined('GA_EVENTS_VERSION'))
|
31 |
define('GA_EVENTS_VERSION',
|
32 |
+
'2.6.2');
|
33 |
|
34 |
// Dependencies
|
35 |
|
js/dist/frontend-scripts-min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var gaeMapper=function(){if("undefined"!=typeof ga_options){function e(e){var n="";return"class"===e.type?n+=".":"id"===e.type&&(n+="#"),n+=e.name}for(var n=[],a=ga_options.click_elements,t=0;t<a.length;t++){var o=a[t];newClickElement={},newClickElement.data={select:e(o),category:o.category,action:o.action,label:o.label,bounce:parseInt(o.non_interaction),evalue:o.value,link_click_delay:parseInt(ga_options.link_clicks_delay),universal:parseInt(ga_options.universal)},newClickElement.selector=newClickElement.data.select,n.push(newClickElement)}var
|
1 |
+
var gaeMapper=function(){if("undefined"!=typeof ga_options){function e(e){var n="";return"class"===e.type?n+=".":"id"===e.type&&(n+="#"),n+=e.name}for(var n=[],a=ga_options.click_elements,t=0;t<a.length;t++){var o=a[t];newClickElement={},newClickElement.data={select:e(o),category:o.category,action:o.action,label:o.label,bounce:parseInt(o.non_interaction),evalue:o.value,link_click_delay:parseInt(ga_options.link_clicks_delay),universal:parseInt(ga_options.universal)},newClickElement.selector=newClickElement.data.select,n.push(newClickElement)}var r=ga_options.scroll_elements,i=[];return void 0!==r&&r.forEach(function(n){i.push({select:e(n),category:n.category,action:n.action,label:n.label,bounce:parseInt(n.non_interaction),evalue:n.value})}),{clickElementsFromDB:n,scrollElementsFromDB:i,advancedMode:ga_options.advanced,forceSnippet:ga_options.force_snippet,emailLinksTracking:ga_options.email_link_tracking,telLinksTracking:ga_options.tel_link_tracking,downloadTracking:ga_options.download_tracking,downloadTrackingFileTypes:ga_options.download_tracking_type,link_clicks_delay:ga_options.link_clicks_delay,snippet_type:ga_options.snippet_type,isFrontPage:gaePlaceholders.is_front_page,pageTitle:gaePlaceholders.page_title,scriptDebugMode:ga_options.script_debug_mode}}}();gaEventsMain=function(e){"use strict";var n;function a(){for(var n=e(window).height(),a=e(document).scrollTop(),t=0;t<gaeMapper.scrollElementsFromDB.length;t++)if(!gaeMapper.scrollElementsFromDB[t].sent){var r=e(gaeMapper.scrollElementsFromDB[t].select);gaeMapper.scrollElementsFromDB[t].offset=r.offset(),gaeMapper.scrollElementsFromDB[t].offset&&a+n>=gaeMapper.scrollElementsFromDB[t].offset.top+r.height()&&(o(gaeMapper.scrollElementsFromDB[t].category,gaeMapper.scrollElementsFromDB[t].action,gaeMapper.scrollElementsFromDB[t].label,gaeMapper.scrollElementsFromDB[t].bounce,gaeMapper.scrollElementsFromDB[t].evalue),gaeMapper.scrollElementsFromDB[t].sent=!0)}}e(document).ready(function(){gaeMapper.clickElementsFromDB.forEach(function(n){e("body").on("click",n.selector,n.data,d)}),"1"===gaeMapper.downloadTracking&&gaeMapper.downloadTrackingFileTypes.forEach(function(n){var a=n.toLowerCase(),o=n.toUpperCase();e("body").on("click",'a[href$=".'+a+'"]',t),e("body").on("click",'a[href$=".'+o+'"]',t)}),"1"===gaeMapper.emailLinksTracking&&e("body").on("click",'a[href^="mailto:"]',function(e){e.preventDefault();var n=this.href.split(":").pop(),a=m();o(a,"Email Link",n,!1,""),u(this,e)}),"1"===gaeMapper.telLinksTracking&&e("body").on("click",'a[href^="tel:"]',function(e){e.preventDefault();var n=this.href.split(":").pop(),a=m();o(a,"Telephone Number Link",n,!1,""),u(this,e)}),e(window).on("scroll",a)});var t=function(e){e.preventDefault();var n=this.href.split("/").pop(),a=m();o(a,"Download",n,!1,""),u(this,e)},o=function(e,a,t,o,d){if(void 0===n)if("undefined"!=typeof ga)n=ga;else if("undefined"!=typeof _gaq)n=_gaq;else if("function"==typeof __gaTracker)n=__gaTracker;else if("function"==typeof gaplusu)n=gaplusu;else if("gtm"!==gaeMapper.snippet_type&&"undefined"==typeof dataLayer)return;e=e||"uncategorized",a=a||"",t=t||"";var u=d||"",_=o||!1;switch(gaeMapper.forceSnippet){case"none":i()?s(e,a,t,u,_):r()?p(e,a,t,u,_):l()?g(e,a,t,u,_):c()&&f(e,a,t,u,_);break;case"gtm":p(e,a,t,u,_);break;case"gst":s(e,a,t,u,_);break;case"universal":g(e,a,t,u,_)}},r=function(){return"gtm"===gaeMapper.snippet_type||"undefined"!=typeof dataLayer&&"undefined"==typeof gtag},i=function(){return"gst"===gaeMapper.snippet_type||"undefined"!=typeof gtag},l=function(){return"universal"===gaeMapper.snippet_type||"undefined"!=typeof ga||"function"==typeof __gaTracker},c=function(){return"legacy"===gaeMapper.snippet_type||"undefined"!=typeof _gaq},p=function(e,n,a,t,o){dataLayer.push({event:"WPGAE",eventCategory:e,eventAction:n,eventLabel:a,eventValue:t,nonInteraction:o})},s=function(e,n,a,t,o){gtag("event",n,{event_category:e,event_label:a,value:t,non_interaction:o})},g=function(e,a,t,o,r){o?n("send","event",e,a,t,o,{nonInteraction:r}):n("send","event",e,a,t,{nonInteraction:r})},f=function(e,a,t,o,r){n.push(["_trackEvent",e,a,t,o,r])},d=function(e){o(e.data.category,e.data.action,e.data.label,e.data.bounce,e.data.evalue,this),void 0!==e.data.link_click_delay&&e.data.link_click_delay>0&&void 0!==e.target.href&&"A"==e.target.nodeName&&u(this,e)},u=function(n,a){a.preventDefault();var t,o=_(a),r=function(n){var a=e(n).attr("target");return void 0!==a&&"_blank"===a.trim()}(n);r&&(t=window.open("","_blank"));var i=k(o);void 0!==i&&""!==i?window.location.hash=i:window.location.href!==o&&setTimeout(function(){r?t.location.href=o:window.location=o},parseInt(gaeMapper.link_clicks_delay),t)},_=function(n){return"A"!==n.target.tagName?e(n.target).parents("a").attr("href"):n.target.href},k=function(e){return void 0!==e&&0===e.indexOf("#")?e:""};function m(){return"1"===gaeMapper.isFrontPage?"Home":void 0!==gaeMapper.pageTitle?gaeMapper.pageTitle:""}}(jQuery);
|
js/dist/frontend-scripts.js
CHANGED
@@ -393,7 +393,7 @@ gaEventsMain = (function ($) {
|
|
393 |
|
394 |
var handleLinks = function (self, event) {
|
395 |
event.preventDefault();
|
396 |
-
var link =
|
397 |
|
398 |
|
399 |
var w;
|
@@ -416,6 +416,16 @@ gaEventsMain = (function ($) {
|
|
416 |
}
|
417 |
}
|
418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
var isJustHashLink = function ( url ) {
|
420 |
if ( typeof url !== "undefined" && url.indexOf( "#" ) === 0 ) {
|
421 |
return url;
|
393 |
|
394 |
var handleLinks = function (self, event) {
|
395 |
event.preventDefault();
|
396 |
+
var link = getUrl(event);
|
397 |
|
398 |
|
399 |
var w;
|
416 |
}
|
417 |
}
|
418 |
|
419 |
+
var getUrl = function ( event ) {
|
420 |
+
var url = "";
|
421 |
+
if ( event.target.tagName !== "A" ) {
|
422 |
+
url = $( event.target ).parents( "a" ).attr( "href" );
|
423 |
+
} else {
|
424 |
+
url = event.target.href;
|
425 |
+
}
|
426 |
+
return url;
|
427 |
+
};
|
428 |
+
|
429 |
var isJustHashLink = function ( url ) {
|
430 |
if ( typeof url !== "undefined" && url.indexOf( "#" ) === 0 ) {
|
431 |
return url;
|
js/main.js
CHANGED
@@ -386,14 +386,14 @@ gaEventsMain = (function ($) {
|
|
386 |
var isNewTab = function (self) {
|
387 |
var target = $(self).attr("target")
|
388 |
if (typeof target !== "undefined" && target.trim() === "_blank") {
|
389 |
-
|
390 |
-
|
391 |
return false;
|
392 |
}
|
393 |
|
394 |
var handleLinks = function (self, event) {
|
395 |
event.preventDefault();
|
396 |
-
var link =
|
397 |
|
398 |
|
399 |
var w;
|
@@ -416,6 +416,16 @@ gaEventsMain = (function ($) {
|
|
416 |
}
|
417 |
}
|
418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
var isJustHashLink = function ( url ) {
|
420 |
if ( typeof url !== "undefined" && url.indexOf( "#" ) === 0 ) {
|
421 |
return url;
|
386 |
var isNewTab = function (self) {
|
387 |
var target = $(self).attr("target")
|
388 |
if (typeof target !== "undefined" && target.trim() === "_blank") {
|
389 |
+
return true;
|
390 |
+
}
|
391 |
return false;
|
392 |
}
|
393 |
|
394 |
var handleLinks = function (self, event) {
|
395 |
event.preventDefault();
|
396 |
+
var link = getUrl(event);
|
397 |
|
398 |
|
399 |
var w;
|
416 |
}
|
417 |
}
|
418 |
|
419 |
+
var getUrl = function ( event ) {
|
420 |
+
var url = "";
|
421 |
+
if ( event.target.tagName !== "A" ) {
|
422 |
+
url = $( event.target ).parents( "a" ).attr( "href" );
|
423 |
+
} else {
|
424 |
+
url = event.target.href;
|
425 |
+
}
|
426 |
+
return url;
|
427 |
+
};
|
428 |
+
|
429 |
var isJustHashLink = function ( url ) {
|
430 |
if ( typeof url !== "undefined" && url.indexOf( "#" ) === 0 ) {
|
431 |
return url;
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: yuvalo
|
3 |
Tags: analytics, google, events, ga, google analytics, tracking
|
4 |
Tested up to: 5.7.2
|
5 |
-
Stable tag: 2.6.
|
6 |
License: GPLv2
|
7 |
Requires at least: 3.0
|
8 |
|
@@ -106,6 +106,9 @@ If you are looking for more in-depth support, we encourage you to check out [WP
|
|
106 |
2. Google Analytics real time events screenshot-4.png
|
107 |
|
108 |
== Changelog ==
|
|
|
|
|
|
|
109 |
= Version 2.6.1 =
|
110 |
1. Added the force Google Analytics snippet option in the General Settings tab.
|
111 |
2. Added tracking for email and download links.
|
2 |
Contributors: yuvalo
|
3 |
Tags: analytics, google, events, ga, google analytics, tracking
|
4 |
Tested up to: 5.7.2
|
5 |
+
Stable tag: 2.6.2
|
6 |
License: GPLv2
|
7 |
Requires at least: 3.0
|
8 |
|
106 |
2. Google Analytics real time events screenshot-4.png
|
107 |
|
108 |
== Changelog ==
|
109 |
+
= Version 2.6.2 =
|
110 |
+
1. Fixes a bug where tracking anchor links leads to an invalid page.
|
111 |
+
|
112 |
= Version 2.6.1 =
|
113 |
1. Added the force Google Analytics snippet option in the General Settings tab.
|
114 |
2. Added tracking for email and download links.
|