WP Google Analytics Events - Version 1.4

Version Description

Download this release

Release Info

Developer yuvalo
Plugin Icon 128x128 WP Google Analytics Events
Version 1.4
Comparing to
See all releases

Code changes from version 1.3 to 1.4

Files changed (3) hide show
  1. ga-scroll-event.php +2 -2
  2. js/ga-scroll-events.js +14 -4
  3. 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: 1.3
7
  Author: Yuval Oren
8
  Author URI: http://wpflow.com
9
  License: GPLv2
@@ -321,7 +321,7 @@ function ga_events_header() {
321
 
322
  ga('create','$id', '$domain');
323
  ga('send', 'pageview');
324
- }
325
  </script>";
326
  } else {
327
  echo "<script type='text/javascript'>
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: 1.4
7
  Author: Yuval Oren
8
  Author URI: http://wpflow.com
9
  License: GPLv2
321
 
322
  ga('create','$id', '$domain');
323
  ga('send', 'pageview');
324
+ }
325
  </script>";
326
  } else {
327
  echo "<script type='text/javascript'>
js/ga-scroll-events.js CHANGED
@@ -13,15 +13,25 @@ var scroll_events = (function ($) {
13
  var scroll_elements = [];
14
  var click_elements = [];
15
  var universal = 0;
 
16
 
17
  var track_event = function (category, action, label, universal) {
18
  var event_category = !category ? '' : category;
19
  var event_action = !action ? '' : action;
20
  var event_label = !label ? '' : label;
21
- if (universal) {
22
- ga('send','event', category, action, label);
 
 
 
 
 
 
 
 
 
23
  } else {
24
- _gaq.push(['_trackEvent',category, action, label]);
25
  }
26
 
27
  };
@@ -68,4 +78,4 @@ var scroll_events = (function ($) {
68
  }
69
  };
70
 
71
- }(jQuery));
13
  var scroll_elements = [];
14
  var click_elements = [];
15
  var universal = 0;
16
+ var ga_element;
17
 
18
  var track_event = function (category, action, label, universal) {
19
  var event_category = !category ? '' : category;
20
  var event_action = !action ? '' : action;
21
  var event_label = !label ? '' : label;
22
+ if (typeof ga_element === "undefined") {
23
+ if (typeof ga !== 'undefined') {
24
+ ga_element = ga;
25
+ } else if (typeof _gaq !== 'undefined') {
26
+ ga_element = _gaq;
27
+ } else if (typeof __gaTracker === "function") {
28
+ ga_element = __gaTracker;
29
+ }
30
+ }
31
+ if (universal) {
32
+ ga_element('send','event', category, action, label);
33
  } else {
34
+ ga_element.push(['_trackEvent',category, action, label]);
35
  }
36
 
37
  };
78
  }
79
  };
80
 
81
+ }(jQuery));
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === WP Google Analytics Events ===
2
  Contributors: yuvalo
3
  Tags: analytics, google, events, ga
4
- Tested up to: 4.0
5
- Stable tag: 1.3
6
  License: GPLv2
7
  Requires at least: 3.0
8
 
@@ -30,6 +30,9 @@ http://www.youtube.com/watch?v=UP8mfuV9huI
30
  == Screenshots ==
31
  1. Plugin Options screenshot-1.png
32
  2. Google Analytics real time events screenshot-2.png
 
 
 
33
  == Changelog == = Version 1.2 =
34
  1. Fixes an issue that would cause tracking a page twice.
35
  2. Admin look and feel changes.
1
  === WP Google Analytics Events ===
2
  Contributors: yuvalo
3
  Tags: analytics, google, events, ga
4
+ Tested up to: 4.1
5
+ Stable tag: 1.4
6
  License: GPLv2
7
  Requires at least: 3.0
8
 
30
  == Screenshots ==
31
  1. Plugin Options screenshot-1.png
32
  2. Google Analytics real time events screenshot-2.png
33
+ == Changelog == = Version 1.4 =
34
+ You can now use the plugin along with Yoast Analytics.
35
+ Just check the "Don't add the GA tracking code" option and if you are using the universal tracking code, check that option as well.
36
  == Changelog == = Version 1.2 =
37
  1. Fixes an issue that would cause tracking a page twice.
38
  2. Admin look and feel changes.