Version Description
Download this release
Release Info
Developer | yuvalo |
Plugin | WP Google Analytics Events |
Version | 2.5.0 |
Comparing to | |
See all releases |
Code changes from version 2.4.6 to 2.5.0
- ga-scroll-event.php +8 -2
- includes/admin.php +22 -4
- js/admin.js +28 -0
- js/ga-scroll-events.js +17 -7
- readme.txt +5 -2
ga-scroll-event.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Google Analytics Events
|
4 |
Plugin URI: http://wpflow.com
|
5 |
Description: Adds the Google Analytics code to your website and enables you to send events on scroll or click.
|
6 |
-
Version: 2.
|
7 |
Author: Yuval Oren
|
8 |
Author URI: http://wpflow.com
|
9 |
License: GPLv2
|
@@ -84,7 +84,7 @@ add_action('init','ga_events_scripts');
|
|
84 |
|
85 |
function ga_events_scripts() {
|
86 |
wp_enqueue_script('jquery');
|
87 |
-
wp_enqueue_script('scrolldepth',plugins_url( '/js/ga-scroll-events.js', __FILE__) , array('jquery'), '2.
|
88 |
}
|
89 |
|
90 |
add_action( 'plugins_loaded', 'ga_events_setup');
|
@@ -141,6 +141,7 @@ function ga_events_footer() {
|
|
141 |
$click = $options['click'];
|
142 |
$universal = $options['universal'];
|
143 |
$gtm = $options['gtm'];
|
|
|
144 |
|
145 |
if ($universal == ""){
|
146 |
$universal = 0;
|
@@ -149,6 +150,10 @@ function ga_events_footer() {
|
|
149 |
if ($gtm == ""){
|
150 |
$gtm = 0;
|
151 |
}
|
|
|
|
|
|
|
|
|
152 |
echo "
|
153 |
<!-- BEGIN: wpflow ga events array -->
|
154 |
<script>
|
@@ -157,6 +162,7 @@ function ga_events_footer() {
|
|
157 |
scroll_events.bind_events( {
|
158 |
universal: ".$universal.",
|
159 |
gtm:".$gtm.",
|
|
|
160 |
|
161 |
scroll_elements: [";
|
162 |
$i = 0;
|
3 |
Plugin Name: WP Google Analytics Events
|
4 |
Plugin URI: http://wpflow.com
|
5 |
Description: Adds the Google Analytics code to your website and enables you to send events on scroll or click.
|
6 |
+
Version: 2.5.0
|
7 |
Author: Yuval Oren
|
8 |
Author URI: http://wpflow.com
|
9 |
License: GPLv2
|
84 |
|
85 |
function ga_events_scripts() {
|
86 |
wp_enqueue_script('jquery');
|
87 |
+
wp_enqueue_script('scrolldepth',plugins_url( '/js/ga-scroll-events.js', __FILE__) , array('jquery'), '2.5.0', false);
|
88 |
}
|
89 |
|
90 |
add_action( 'plugins_loaded', 'ga_events_setup');
|
141 |
$click = $options['click'];
|
142 |
$universal = $options['universal'];
|
143 |
$gtm = $options['gtm'];
|
144 |
+
$gst = $options['gst'];
|
145 |
|
146 |
if ($universal == ""){
|
147 |
$universal = 0;
|
150 |
if ($gtm == ""){
|
151 |
$gtm = 0;
|
152 |
}
|
153 |
+
|
154 |
+
if ($gst == ""){
|
155 |
+
$gst = 0;
|
156 |
+
}
|
157 |
echo "
|
158 |
<!-- BEGIN: wpflow ga events array -->
|
159 |
<script>
|
162 |
scroll_events.bind_events( {
|
163 |
universal: ".$universal.",
|
164 |
gtm:".$gtm.",
|
165 |
+
gst:".$gst.",
|
166 |
|
167 |
scroll_elements: [";
|
168 |
$i = 0;
|
includes/admin.php
CHANGED
@@ -103,7 +103,7 @@ if ($active_page == 'wp-google-analytics-events') {
|
|
103 |
<tr class="tfoot">
|
104 |
<td>
|
105 |
<div class="wpcta">
|
106 |
-
<a class="button-primary button-large" target="_blank" href="https://wpflow.com/upgrade
|
107 |
<span class="btn-title ">
|
108 |
Upgrade Now
|
109 |
</span>
|
@@ -270,6 +270,7 @@ function ga_events_admin_init() {
|
|
270 |
add_settings_field('ga_events_id', '','ga_events_setting_input','ga_events','ga_events_main');
|
271 |
add_settings_field('ga_events_exclude_snippet', '','ga_events_setting_snippet_input','ga_events','ga_events_main');
|
272 |
add_settings_field('ga_events_gtm', '', 'ga_events_setting_gtm_input', 'ga_events', 'ga_events_main');
|
|
|
273 |
add_settings_field('ga_events_universal', '','ga_events_setting_uni_input','ga_events','ga_events_main');
|
274 |
add_settings_field('ga_events_anonymizeip', '','ga_events_setting_anon_input','ga_events','ga_events_main');
|
275 |
add_settings_field('ga_events_advanced', '','ga_events_setting_adv_input','ga_events','ga_events_main');
|
@@ -290,14 +291,19 @@ function ga_events_section_text() {
|
|
290 |
function ga_events_whatsnew_section_content() {
|
291 |
ob_start(); ?>
|
292 |
<div class="wpgae-container wpgae-container__warning">
|
293 |
-
<h3><span class="dashicons dashicons-flag"></span> What's New (
|
294 |
<div id="wpgae-warnings">
|
295 |
<p></p>
|
296 |
<div class="container" id="wpgae-warnings-active">
|
|
|
|
|
|
|
|
|
|
|
297 |
<div class="wpgae-alert-holder">
|
298 |
<div class="wpgae-alert">
|
299 |
<p>The admin UI got a little update - We started working with ajax forms. These changes solve a problem that some of the users had with adding a long list of events.</p>
|
300 |
-
</div>
|
301 |
</div>
|
302 |
<div class="wpgae-alert-holder">
|
303 |
<div class="wpgae-alert">
|
@@ -375,6 +381,17 @@ function ga_events_setting_gtm_input() {
|
|
375 |
echo "<a style='margin-left: 5px;' href='https://wpflow.com/knowledgebase/google-tag-manager-support/' target='_blank'>Read More...</a>";
|
376 |
}
|
377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
function ga_events_setting_uni_input() {
|
379 |
$options = get_option('ga_events_options');
|
380 |
$id = $options['universal'];
|
@@ -596,6 +613,7 @@ function ga_events_validate($form){
|
|
596 |
$updated['anonymizeip'] = $form['anonymizeip'];
|
597 |
$updated['advanced'] = $form['advanced'];
|
598 |
$updated['gtm'] = $form['gtm'];
|
|
|
599 |
}
|
600 |
|
601 |
return $updated;
|
@@ -609,7 +627,7 @@ function ga_events_admin_footer() {
|
|
609 |
<script>
|
610 |
jQuery('body').on('click','a[href="admin.php?page=wp-google-analytics-events-upgrade"]', function (e) {
|
611 |
e.preventDefault();
|
612 |
-
window.open('https://wpflow.com/upgrade
|
613 |
});
|
614 |
</script>
|
615 |
<?php
|
103 |
<tr class="tfoot">
|
104 |
<td>
|
105 |
<div class="wpcta">
|
106 |
+
<a class="button-primary button-large" target="_blank" href="https://wpflow.com/upgrade/?utm_source=wpadmin&utm_medium=banner&utm_campaign=genreal">
|
107 |
<span class="btn-title ">
|
108 |
Upgrade Now
|
109 |
</span>
|
270 |
add_settings_field('ga_events_id', '','ga_events_setting_input','ga_events','ga_events_main');
|
271 |
add_settings_field('ga_events_exclude_snippet', '','ga_events_setting_snippet_input','ga_events','ga_events_main');
|
272 |
add_settings_field('ga_events_gtm', '', 'ga_events_setting_gtm_input', 'ga_events', 'ga_events_main');
|
273 |
+
add_settings_field('ga_events_gst', '', 'ga_events_setting_gst_input', 'ga_events', 'ga_events_main');
|
274 |
add_settings_field('ga_events_universal', '','ga_events_setting_uni_input','ga_events','ga_events_main');
|
275 |
add_settings_field('ga_events_anonymizeip', '','ga_events_setting_anon_input','ga_events','ga_events_main');
|
276 |
add_settings_field('ga_events_advanced', '','ga_events_setting_adv_input','ga_events','ga_events_main');
|
291 |
function ga_events_whatsnew_section_content() {
|
292 |
ob_start(); ?>
|
293 |
<div class="wpgae-container wpgae-container__warning">
|
294 |
+
<h3><span class="dashicons dashicons-flag"></span> What's New (1)</h3>
|
295 |
<div id="wpgae-warnings">
|
296 |
<p></p>
|
297 |
<div class="container" id="wpgae-warnings-active">
|
298 |
+
<div class="wpgae-alert-holder">
|
299 |
+
<div class="wpgae-alert">
|
300 |
+
<p>Global Site Tag code support. Google recently added the new Global Site Tag feature, and made it the default tracking code. If you migrated to this new code, check the relevant option in the General Settings tab.
|
301 |
+
</div>
|
302 |
+
</div>
|
303 |
<div class="wpgae-alert-holder">
|
304 |
<div class="wpgae-alert">
|
305 |
<p>The admin UI got a little update - We started working with ajax forms. These changes solve a problem that some of the users had with adding a long list of events.</p>
|
306 |
+
</div>
|
307 |
</div>
|
308 |
<div class="wpgae-alert-holder">
|
309 |
<div class="wpgae-alert">
|
381 |
echo "<a style='margin-left: 5px;' href='https://wpflow.com/knowledgebase/google-tag-manager-support/' target='_blank'>Read More...</a>";
|
382 |
}
|
383 |
|
384 |
+
function ga_events_setting_gst_input() {
|
385 |
+
$options = get_option('ga_events_options');
|
386 |
+
if (isset($options['gst'])) {
|
387 |
+
$id = $options['gst'];
|
388 |
+
} else {
|
389 |
+
$id = 0;
|
390 |
+
}
|
391 |
+
echo "<label >I'm using the Global Site Tags code " . ga_tooltip('Support for the Global Site Tag - Not to be confused with the Google Tag Manager') . " </label>";
|
392 |
+
echo "<input style='margin-left: 5px;' id='gst' name='ga_events_options[gst]' type='checkbox' value='1' " . checked($id, 1, false) . " />";
|
393 |
+
}
|
394 |
+
|
395 |
function ga_events_setting_uni_input() {
|
396 |
$options = get_option('ga_events_options');
|
397 |
$id = $options['universal'];
|
613 |
$updated['anonymizeip'] = $form['anonymizeip'];
|
614 |
$updated['advanced'] = $form['advanced'];
|
615 |
$updated['gtm'] = $form['gtm'];
|
616 |
+
$updated['gst'] = $form['gst'];
|
617 |
}
|
618 |
|
619 |
return $updated;
|
627 |
<script>
|
628 |
jQuery('body').on('click','a[href="admin.php?page=wp-google-analytics-events-upgrade"]', function (e) {
|
629 |
e.preventDefault();
|
630 |
+
window.open('https://wpflow.com/upgrade/?utm_source=wpadmin&utm_medium=banner&utm_campaign=nav', '_blank');
|
631 |
});
|
632 |
</script>
|
633 |
<?php
|
js/admin.js
CHANGED
@@ -56,6 +56,17 @@ if (document.location.href.indexOf("wp-google-analytics-events") > -1) {
|
|
56 |
jQuery('#anonymizeip').attr("disabled", true);
|
57 |
jQuery('#snippet')[0].checked = true;
|
58 |
jQuery('#snippet').attr("disabled", true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
jQuery('#gtm').change(function () {
|
@@ -64,9 +75,26 @@ if (document.location.href.indexOf("wp-google-analytics-events") > -1) {
|
|
64 |
jQuery('#anonymizeip').attr("disabled", true);
|
65 |
jQuery('#snippet')[0].checked = true;
|
66 |
jQuery('#snippet').attr("disabled", true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
} else {
|
68 |
jQuery('#anonymizeip').removeAttr("disabled");
|
69 |
jQuery('#snippet').removeAttr("disabled");
|
|
|
70 |
}
|
71 |
});
|
72 |
}
|
56 |
jQuery('#anonymizeip').attr("disabled", true);
|
57 |
jQuery('#snippet')[0].checked = true;
|
58 |
jQuery('#snippet').attr("disabled", true);
|
59 |
+
jQuery('#gst')[0].checked = false;
|
60 |
+
jQuery('#gst').attr("disabled", true);
|
61 |
+
}
|
62 |
+
|
63 |
+
if (jQuery('#gst').is(":checked")) {
|
64 |
+
jQuery('#anonymizeip')[0].checked = false;
|
65 |
+
jQuery('#anonymizeip').attr("disabled", true);
|
66 |
+
jQuery('#snippet')[0].checked = true;
|
67 |
+
jQuery('#snippet').attr("disabled", true);
|
68 |
+
jQuery('#gtm')[0].checked = false;
|
69 |
+
jQuery('#gtm').attr("disabled", true);
|
70 |
}
|
71 |
|
72 |
jQuery('#gtm').change(function () {
|
75 |
jQuery('#anonymizeip').attr("disabled", true);
|
76 |
jQuery('#snippet')[0].checked = true;
|
77 |
jQuery('#snippet').attr("disabled", true);
|
78 |
+
jQuery('#gst')[0].checked = false;
|
79 |
+
jQuery('#gst').attr("disabled", true);
|
80 |
+
} else {
|
81 |
+
jQuery('#anonymizeip').removeAttr("disabled");
|
82 |
+
jQuery('#snippet').removeAttr("disabled");
|
83 |
+
jQuery('#gst').attr("disabled", false);
|
84 |
+
}
|
85 |
+
});
|
86 |
+
jQuery('#gst').change(function () {
|
87 |
+
if (this.checked) {
|
88 |
+
jQuery('#anonymizeip')[0].checked = false;
|
89 |
+
jQuery('#anonymizeip').attr("disabled", true);
|
90 |
+
jQuery('#snippet')[0].checked = true;
|
91 |
+
jQuery('#snippet').attr("disabled", true);
|
92 |
+
jQuery('#gtm')[0].checked = false;
|
93 |
+
jQuery('#gtm').attr("disabled", true);
|
94 |
} else {
|
95 |
jQuery('#anonymizeip').removeAttr("disabled");
|
96 |
jQuery('#snippet').removeAttr("disabled");
|
97 |
+
jQuery('#gtm').attr("disabled", false);
|
98 |
}
|
99 |
});
|
100 |
}
|
js/ga-scroll-events.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*!
|
2 |
-
* WP Googel Analytics Events | v2.
|
3 |
* Copyright (c) 2013 Yuval Oren (@yuvalo)
|
4 |
* License: GPLv2
|
5 |
*/
|
@@ -14,6 +14,7 @@ var scroll_events = (function ($) {
|
|
14 |
var click_elements = [];
|
15 |
var universal = 0;
|
16 |
var gtm = 0;
|
|
|
17 |
var ga_element;
|
18 |
|
19 |
var track_event = function (category, action, label, universal, bounce, evalue ){
|
@@ -32,20 +33,28 @@ var scroll_events = (function ($) {
|
|
32 |
}
|
33 |
else if( typeof __gaTracker === "function" ){
|
34 |
ga_element = __gaTracker;
|
35 |
-
} else if (!gtm){
|
36 |
return;
|
37 |
}
|
38 |
}
|
39 |
|
40 |
if (gtm) {
|
41 |
dataLayer.push({
|
42 |
-
'event'
|
43 |
-
'eventCategory'
|
44 |
-
'eventAction'
|
45 |
-
'eventLabel'
|
46 |
-
'eventValue'
|
47 |
'nonInteraction': event_bounce
|
48 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
} else if( universal ){
|
50 |
// ga_element('send','event', category, action, label);
|
51 |
if (event_value) {
|
@@ -123,6 +132,7 @@ var scroll_events = (function ($) {
|
|
123 |
click_elements = settings.click_elements;
|
124 |
universal = settings.universal;
|
125 |
gtm = settings.gtm;
|
|
|
126 |
|
127 |
var i;
|
128 |
for (i = 0; i < click_elements.length; i++) {
|
1 |
/*!
|
2 |
+
* WP Googel Analytics Events | v2.5.0
|
3 |
* Copyright (c) 2013 Yuval Oren (@yuvalo)
|
4 |
* License: GPLv2
|
5 |
*/
|
14 |
var click_elements = [];
|
15 |
var universal = 0;
|
16 |
var gtm = 0;
|
17 |
+
var gst = 0;
|
18 |
var ga_element;
|
19 |
|
20 |
var track_event = function (category, action, label, universal, bounce, evalue ){
|
33 |
}
|
34 |
else if( typeof __gaTracker === "function" ){
|
35 |
ga_element = __gaTracker;
|
36 |
+
} else if (!gtm && !gst){
|
37 |
return;
|
38 |
}
|
39 |
}
|
40 |
|
41 |
if (gtm) {
|
42 |
dataLayer.push({
|
43 |
+
'event': 'WPGAE',
|
44 |
+
'eventCategory': category,
|
45 |
+
'eventAction': action,
|
46 |
+
'eventLabel': label,
|
47 |
+
'eventValue': event_value,
|
48 |
'nonInteraction': event_bounce
|
49 |
});
|
50 |
+
} else if (gst) {
|
51 |
+
gtag('event', action, {
|
52 |
+
// Event parameters
|
53 |
+
'event_category': category,
|
54 |
+
'event_label': label,
|
55 |
+
'value': event_value,
|
56 |
+
'non_interaction': event_bounce
|
57 |
+
});
|
58 |
} else if( universal ){
|
59 |
// ga_element('send','event', category, action, label);
|
60 |
if (event_value) {
|
132 |
click_elements = settings.click_elements;
|
133 |
universal = settings.universal;
|
134 |
gtm = settings.gtm;
|
135 |
+
gst = settings.gst;
|
136 |
|
137 |
var i;
|
138 |
for (i = 0; i < click_elements.length; i++) {
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== WP Google Analytics Events ===
|
2 |
-
Contributors: yuvalo
|
3 |
Tags: analytics, google, events, ga, google analytics, tracking
|
4 |
Tested up to: 4.8.2
|
5 |
-
Stable tag: 2.
|
6 |
License: GPLv2
|
7 |
Requires at least: 3.0
|
8 |
|
@@ -91,6 +91,9 @@ If you are looking for more in-depth support, we encourage you to check out [WP
|
|
91 |
2. Google Analytics real time events screenshot-2.png
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
94 |
= Version 2.4.6 =
|
95 |
1. Minor bug fixes
|
96 |
|
1 |
=== WP Google Analytics Events ===
|
2 |
+
Contributors: yuvalo
|
3 |
Tags: analytics, google, events, ga, google analytics, tracking
|
4 |
Tested up to: 4.8.2
|
5 |
+
Stable tag: 2.5.0
|
6 |
License: GPLv2
|
7 |
Requires at least: 3.0
|
8 |
|
91 |
2. Google Analytics real time events screenshot-2.png
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= Version 2.5.0 =
|
95 |
+
1. Added support for Global Site Tags - The new tracking code from Google Analytics
|
96 |
+
|
97 |
= Version 2.4.6 =
|
98 |
1. Minor bug fixes
|
99 |
|