Google Analytics for WordPress by MonsterInsights - Version 1.2

Version Description

Download this release

Release Info

Developer joostdevalk
Plugin Icon 128x128 Google Analytics for WordPress by MonsterInsights
Version 1.2
Comparing to
See all releases

Code changes from version 1.1 to 1.2

gapp/googleanalytics.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Analytics for WordPress
4
  Plugin URI: http://www.joostdevalk.nl/wordpress/analytics/
5
  Description: This plugin makes it simple to add Google Analytics with extra search engines and automatic clickout and download tracking to your WordPress blog.
6
  Author: Joost de Valk
7
- Version: 1.1
8
  Author URI: http://www.joostdevalk.nl/
9
  License: GPL
10
 
@@ -74,6 +74,12 @@ if ( ! class_exists( 'GA_Admin' ) ) {
74
  $options['imagese'] = false;
75
  }
76
 
 
 
 
 
 
 
77
  if (isset($_POST['userv2'])) {
78
  $options['userv2'] = true;
79
  } else {
@@ -175,7 +181,10 @@ if ( ! class_exists( 'GA_Admin' ) ) {
175
  <label for="extrase">Track extra Search Engines</label><br/>
176
  <br/>
177
  <input type="checkbox" id="imagese" name="imagese" <?php if ($options['imagese']) echo ' checked="checked" '; ?>/>
178
- <label for="imagese">Track Google Image search keywords (this needs the tracking of extra search engines too)</label><br/>
 
 
 
179
  <br/>
180
  <input type="checkbox" id="userv2" name="userv2" <?php if ($options['userv2']) echo ' checked="checked" '; ?>/>
181
  <label for="userv2">I use Urchin too, so add <code>_userv = 2;</code></label>
@@ -260,8 +269,12 @@ if ( ! class_exists( 'GA_Filter' ) ) {
260
  if ( $options["extrase"] == true ) {
261
  echo("\t<script src=\"".get_bloginfo('url')."/wp-content/plugins/gapp/custom_se.js\" type=\"text/javascript\"></script>\n");
262
  }
263
- if ( $options['imagese'] ) {
 
 
264
  echo("\t<script src=\"".get_bloginfo('url')."/wp-content/plugins/gapp/track-imagesearch.js\" type=\"text/javascript\"></script>\n");
 
 
265
  }
266
  echo("\t<script type=\"text/javascript\">\n");
267
  echo("\t\t_uacct = \"".$options["uastring"]."\";\n");
4
  Plugin URI: http://www.joostdevalk.nl/wordpress/analytics/
5
  Description: This plugin makes it simple to add Google Analytics with extra search engines and automatic clickout and download tracking to your WordPress blog.
6
  Author: Joost de Valk
7
+ Version: 1.2
8
  Author URI: http://www.joostdevalk.nl/
9
  License: GPL
10
 
74
  $options['imagese'] = false;
75
  }
76
 
77
+ if (isset($_POST['yahooreffirst'])) {
78
+ $options['yahooreffirst'] = true;
79
+ } else {
80
+ $options['yahooreffirst'] = false;
81
+ }
82
+
83
  if (isset($_POST['userv2'])) {
84
  $options['userv2'] = true;
85
  } else {
181
  <label for="extrase">Track extra Search Engines</label><br/>
182
  <br/>
183
  <input type="checkbox" id="imagese" name="imagese" <?php if ($options['imagese']) echo ' checked="checked" '; ?>/>
184
+ <label for="imagese">Track Google Image search keywords (this needs the tracking of extra search engines too) (<a href="http://www.joostdevalk.nl/google-analytics-and-google-image-search-revisited/">more info</a>)</label><br/>
185
+ <br/>
186
+ <input type="checkbox" id="yahooreffirst" name="yahooreffirst" <?php if ($options['yahooreffirst']) echo ' checked="checked" '; ?>/>
187
+ <label for="yahooreffirst">Track the keyword people used to search before they refined their search queries in Yahoo! (<a href="http://www.joostdevalk.nl/yahoos-search-assist-and-tracking-keywords/">more info</a>)</label><br/>
188
  <br/>
189
  <input type="checkbox" id="userv2" name="userv2" <?php if ($options['userv2']) echo ' checked="checked" '; ?>/>
190
  <label for="userv2">I use Urchin too, so add <code>_userv = 2;</code></label>
269
  if ( $options["extrase"] == true ) {
270
  echo("\t<script src=\"".get_bloginfo('url')."/wp-content/plugins/gapp/custom_se.js\" type=\"text/javascript\"></script>\n");
271
  }
272
+ if ( $options['imagese'] && $options['yahooreffirst']) {
273
+ echo("\t<script src=\"".get_bloginfo('url')."/wp-content/plugins/gapp/track-imagesearch-and-yahoo.js\" type=\"text/javascript\"></script>\n");
274
+ } else if ( $options['imagese'] && !$options['yahooreffirst'] ) {
275
  echo("\t<script src=\"".get_bloginfo('url')."/wp-content/plugins/gapp/track-imagesearch.js\" type=\"text/javascript\"></script>\n");
276
+ } else if ( !$options['imagese'] && $options['yahooreffirst'] ) {
277
+ echo("\t<script src=\"".get_bloginfo('url')."/wp-content/plugins/gapp/track-yahoo.js\" type=\"text/javascript\"></script>\n");
278
  }
279
  echo("\t<script type=\"text/javascript\">\n");
280
  echo("\t\t_uacct = \"".$options["uastring"]."\";\n");
gapp/track-imagesearch-and-yahoo.js ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function _uInfo(page) {
2
+ var p,s="",dm="",pg=_udl.pathname+_udl.search;
3
+ if (page && page!="") pg=_uES(page,1);
4
+ if (_ubd.referrer.search(/search.yahoo/) != -1 && _ubd.referrer.search(/&rp=/) != -1) {
5
+ var ref = _ubd.referrer;
6
+ var pkwregex = new RegExp("&rp=([^&]+)");
7
+ var pkw = pkwregex.exec(ref);
8
+ var kwregex = new RegExp("&p=([^&]+)");
9
+ var kw = kwregex.exec(ref);
10
+ var tldregex = new RegExp("search.yahoo.([^\/]+)");
11
+ var tldmatch = tldregex.exec(ref);
12
+ _ur = "http://search.yahoo." + tldmatch[1] + "/search?p=" + kw[1] + "%20[" +pkw[1] +"]";
13
+ } else if (_ubd.referrer.search(/images.google/) != -1) {
14
+ var ref = _ubd.referrer;
15
+ var tldregex = new RegExp("images.google.([^\/]+)");
16
+ var tldmatch = tldregex.exec(ref);
17
+ var imgregex = new RegExp("&prev=([^&]+)");
18
+ var refmatch = imgregex.exec(ref);
19
+ refmatch = refmatch[1].replace(/%26/g,"&");
20
+ refmatch = refmatch.replace(/%3F/g,"?");
21
+ refmatch = refmatch.replace(/%3D/g,"=");
22
+ _ur = "http://www.images.google." + tldmatch[1] + refmatch;
23
+ } else {
24
+ _ur=_ubd.referrer;
25
+ }
26
+ if (!_ur || _ur=="") { _ur="-"; }
27
+ else {
28
+ dm=_ubd.domain;
29
+ if(_utcp && _utcp!="/") dm+=_utcp;
30
+ p=_ur.indexOf(dm);
31
+ if ((p>=0) && (p<=8)) { _ur="0"; }
32
+ if (_ur.indexOf("[")==0 && _ur.lastIndexOf("]")==(_ur.length-1)) { _ur="-"; }
33
+ }
34
+ s+="&utmn="+_uu;
35
+ if (_ufsc) s+=_uBInfo();
36
+ if (_uctm) s+=_uCInfo();
37
+ if (_utitle && _ubd.title && _ubd.title!="") s+="&utmdt="+_uES(_ubd.title);
38
+ if (_udl.hostname && _udl.hostname!="") s+="&utmhn="+_uES(_udl.hostname);
39
+ s+="&utmr="+_ur;
40
+ s+="&utmp="+pg;
41
+ if ((_userv==0 || _userv==2) && _uSP()) {
42
+ var i=new Image(1,1);
43
+ i.src=_ugifpath+"?"+"utmwv="+_uwv+s;
44
+ i.onload=function() {_uVoid();}
45
+ }
46
+ if ((_userv==1 || _userv==2) && _uSP()) {
47
+ var i2=new Image(1,1);
48
+ i2.src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+_uGCS();
49
+ i2.onload=function() { _uVoid(); }
50
+ }
51
+ return;
52
+ }
gapp/track-yahoo.js ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function _uInfo(page) {
2
+ var p,s="",dm="",pg=_udl.pathname+_udl.search;
3
+ if (page && page!="") pg=_uES(page,1);
4
+ if (_ubd.referrer.search(/search.yahoo/) != -1 && _ubd.referrer.search(/&rp=/) != -1) {
5
+ var ref = _ubd.referrer;
6
+ var pkwregex = new RegExp("&rp=([^&]+)");
7
+ var pkw = pkwregex.exec(ref);
8
+ var kwregex = new RegExp("&p=([^&]+)");
9
+ var kw = kwregex.exec(ref);
10
+ var tldregex = new RegExp("search.yahoo.([^\/]+)");
11
+ var tldmatch = tldregex.exec(ref);
12
+ _ur = "http://search.yahoo." + tldmatch[1] + "/search?p=" + kw[1] + "%20[" +pkw[1] +"]";
13
+ } else {
14
+ _ur=_ubd.referrer;
15
+ }
16
+ if (!_ur || _ur=="") { _ur="-"; }
17
+ else {
18
+ dm=_ubd.domain;
19
+ if(_utcp && _utcp!="/") dm+=_utcp;
20
+ p=_ur.indexOf(dm);
21
+ if ((p>=0) && (p<=8)) { _ur="0"; }
22
+ if (_ur.indexOf("[")==0 && _ur.lastIndexOf("]")==(_ur.length-1)) { _ur="-"; }
23
+ }
24
+ s+="&utmn="+_uu;
25
+ if (_ufsc) s+=_uBInfo();
26
+ if (_uctm) s+=_uCInfo();
27
+ if (_utitle && _ubd.title && _ubd.title!="") s+="&utmdt="+_uES(_ubd.title);
28
+ if (_udl.hostname && _udl.hostname!="") s+="&utmhn="+_uES(_udl.hostname);
29
+ s+="&utmr="+_ur;
30
+ s+="&utmp="+pg;
31
+ if ((_userv==0 || _userv==2) && _uSP()) {
32
+ var i=new Image(1,1);
33
+ i.src=_ugifpath+"?"+"utmwv="+_uwv+s;
34
+ i.onload=function() {_uVoid();}
35
+ }
36
+ if ((_userv==1 || _userv==2) && _uSP()) {
37
+ var i2=new Image(1,1);
38
+ i2.src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+_uGCS();
39
+ i2.onload=function() { _uVoid(); }
40
+ }
41
+ return;
42
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.joostdevalk.nl/donate/
4
  Tags: analytics, google analytics, statistics
5
  Requires at least: 2.2
6
  Tested up to: 2.3
7
- Stable tag: 1.1
8
 
9
  The Google Analytics for WordPress plugina automatically tracks and segments all outbound links from within posts, comment author links, links within comments, blogroll links and downloads. It also allows you to add extra search engines, track image search queries and it will even work together with Urchin.
10
 
4
  Tags: analytics, google analytics, statistics
5
  Requires at least: 2.2
6
  Tested up to: 2.3
7
+ Stable tag: 1.2
8
 
9
  The Google Analytics for WordPress plugina automatically tracks and segments all outbound links from within posts, comment author links, links within comments, blogroll links and downloads. It also allows you to add extra search engines, track image search queries and it will even work together with Urchin.
10