Version Description
Download this release
Release Info
Developer | joostdevalk |
Plugin | Google Analytics for WordPress by MonsterInsights |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 1.6 to 2.0
- gapp/adsense-track.js +76 -0
- gapp/googleanalytics.php +30 -19
- readme.txt +4 -4
gapp/adsense-track.js
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
/******************************************************************************
|
3 |
+
Modified with permission from Jim Rotherford's Adsense Pepper
|
4 |
+
(http://www.digitalmediaminute.com/)
|
5 |
+
|
6 |
+
� SeoBook.com. For updates see http://www.seobook.com/archives/001370.shtml
|
7 |
+
You are allowed to use this but you should keep this copyright notice here
|
8 |
+
|
9 |
+
******************************************************************************/
|
10 |
+
function as_click () {
|
11 |
+
urchinTracker ('/outbound/asclick');
|
12 |
+
}
|
13 |
+
if(typeof window.addEventListener != 'undefined') {
|
14 |
+
window.addEventListener('load', adsense_init, false);
|
15 |
+
} else if(typeof document.addEventListener != 'undefined') {
|
16 |
+
document.addEventListener('load', adsense_init, false);
|
17 |
+
} else if(typeof window.attachEvent != 'undefined') {
|
18 |
+
window.attachEvent('onload', adsense_init);
|
19 |
+
} else {
|
20 |
+
if(typeof window.onload == 'function') {
|
21 |
+
var existing = onload;
|
22 |
+
window.onload = function() {
|
23 |
+
existing();
|
24 |
+
adsense_init();
|
25 |
+
};
|
26 |
+
} else {
|
27 |
+
window.onload = adsense_init;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
function adsense_init () {
|
31 |
+
if (document.all) {
|
32 |
+
var el = document.getElementsByTagName("iframe");
|
33 |
+
for(var i = 0; i < el.length; i++) {
|
34 |
+
if(el[i].src.indexOf('googlesyndication.com') > -1) {
|
35 |
+
el[i].onfocus = as_click;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
} else {
|
39 |
+
window.addEventListener('beforeunload', doPageExit, false);
|
40 |
+
window.addEventListener('mousemove', getMouse, true);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
var px;
|
44 |
+
var py;
|
45 |
+
function getMouse(e) {
|
46 |
+
px=e.pageX;
|
47 |
+
py=e.clientY;
|
48 |
+
}
|
49 |
+
function findY(obj) {
|
50 |
+
var y = 0;
|
51 |
+
while (obj) {
|
52 |
+
y += obj.offsetTop;
|
53 |
+
obj = obj.offsetParent;
|
54 |
+
}
|
55 |
+
return(y);
|
56 |
+
}
|
57 |
+
function findX(obj) {
|
58 |
+
var x = 0;
|
59 |
+
while (obj) {
|
60 |
+
x += obj.offsetLeft;
|
61 |
+
obj = obj.offsetParent;
|
62 |
+
}
|
63 |
+
return(x);
|
64 |
+
}
|
65 |
+
function doPageExit(e) {
|
66 |
+
ad = document.getElementsByTagName("iframe");
|
67 |
+
for (i=0; i<ad.length; i++) {
|
68 |
+
var adLeft = findX(ad[i]);
|
69 |
+
var adTop = findY(ad[i]);
|
70 |
+
var inFrameX = (px > (adLeft - 10) && px < (parseInt(adLeft) + parseInt(ad[i].width) + 15));
|
71 |
+
var inFrameY = (py > (adTop - 10) && py < (parseInt(adTop) + parseInt(ad[i].height) + 10));
|
72 |
+
if (inFrameY && inFrameX) {
|
73 |
+
urchinTracker('/outbound/asclick');
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
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:
|
8 |
Author URI: http://www.joostdevalk.nl/
|
9 |
License: GPL
|
10 |
|
@@ -86,6 +86,12 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
86 |
$options['admintracking'] = false;
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
if (isset($_POST['userv2'])) {
|
90 |
$options['userv2'] = true;
|
91 |
} else {
|
@@ -183,6 +189,9 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
183 |
<input type="checkbox" id="trackoutbound" name="trackoutbound" <?php if ($options['trackoutbound']) echo ' checked="checked" '; ?>/>
|
184 |
<label for="trackoutbound">Track outbound clicks & downloads</label><br/>
|
185 |
<br/>
|
|
|
|
|
|
|
186 |
<input type="checkbox" id="extrase" name="extrase" <?php if ($options['extrase']) echo ' checked="checked" '; ?>/>
|
187 |
<label for="extrase">Track extra Search Engines</label><br/>
|
188 |
<br/>
|
@@ -296,6 +305,9 @@ if ( ! class_exists( 'GA_Filter' ) ) {
|
|
296 |
}
|
297 |
}
|
298 |
|
|
|
|
|
|
|
299 |
/* Create an array which contians:
|
300 |
* "domain" e.g. boakes.org
|
301 |
* "host" e.g. store.boakes.org
|
@@ -459,22 +471,21 @@ if ($opt == "") {
|
|
459 |
// adds the menu item to the admin interface
|
460 |
add_action('admin_menu', array('GA_Admin','add_config_page'));
|
461 |
|
462 |
-
//
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
//}
|
480 |
?>
|
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: 2.0
|
8 |
Author URI: http://www.joostdevalk.nl/
|
9 |
License: GPL
|
10 |
|
86 |
$options['admintracking'] = false;
|
87 |
}
|
88 |
|
89 |
+
if (isset($_POST['trackadsense'])) {
|
90 |
+
$options['trackadsense'] = true;
|
91 |
+
} else {
|
92 |
+
$options['trackadsense'] = false;
|
93 |
+
}
|
94 |
+
|
95 |
if (isset($_POST['userv2'])) {
|
96 |
$options['userv2'] = true;
|
97 |
} else {
|
189 |
<input type="checkbox" id="trackoutbound" name="trackoutbound" <?php if ($options['trackoutbound']) echo ' checked="checked" '; ?>/>
|
190 |
<label for="trackoutbound">Track outbound clicks & downloads</label><br/>
|
191 |
<br/>
|
192 |
+
<input type="checkbox" id="trackadsense" name="trackadsense" <?php if ($options['trackadsense']) echo ' checked="checked" '; ?>/>
|
193 |
+
<label for="trackadsense">Track AdSense clicks</label><br/>
|
194 |
+
<br/>
|
195 |
<input type="checkbox" id="extrase" name="extrase" <?php if ($options['extrase']) echo ' checked="checked" '; ?>/>
|
196 |
<label for="extrase">Track extra Search Engines</label><br/>
|
197 |
<br/>
|
305 |
}
|
306 |
}
|
307 |
|
308 |
+
function track_adsense() {
|
309 |
+
echo("\t<script src=\"".get_bloginfo('wpurl')."/wp-content/plugins/gapp/adsense-track.js\" type=\"text/javascript\"></script>\n");
|
310 |
+
}
|
311 |
/* Create an array which contians:
|
312 |
* "domain" e.g. boakes.org
|
313 |
* "host" e.g. store.boakes.org
|
471 |
// adds the menu item to the admin interface
|
472 |
add_action('admin_menu', array('GA_Admin','add_config_page'));
|
473 |
|
474 |
+
// adds the footer so the javascript is loaded
|
475 |
+
if ($options['position'] =='footer') {
|
476 |
+
add_action('wp_footer', array('GA_Filter','spool_analytics'));
|
477 |
+
} else if ($options['position'] =='header') {
|
478 |
+
add_action('wp_head', array('GA_Filter','spool_analytics'));
|
479 |
+
}
|
480 |
+
if ($options['trackoutbound']) {
|
481 |
+
// filters alter the existing content
|
482 |
+
add_filter('the_content', array('GA_Filter','the_content'), 99);
|
483 |
+
add_filter('the_excerpt', array('GA_Filter','the_content'), 99);
|
484 |
+
add_filter('comment_text', array('GA_Filter','comment_text'), 99);
|
485 |
+
add_filter('get_bookmarks', array('GA_Filter','bookmarks'), 99);
|
486 |
+
add_filter('get_comment_author_link', array('GA_Filter','comment_author_link'), 99);
|
487 |
+
}
|
488 |
+
if ($options['trackadsense']) {
|
489 |
+
add_action('wp_footer', array('GA_Filter','track_adsense'));
|
490 |
+
}
|
|
|
491 |
?>
|
readme.txt
CHANGED
@@ -3,14 +3,14 @@ Contributors: joostdevalk
|
|
3 |
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:
|
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 |
|
11 |
== Description ==
|
12 |
|
13 |
-
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.
|
14 |
|
15 |
In the options panel for the plugin, you can determine the prefixes to use for the different kinds of outbound links and downloads it tracks.
|
16 |
|
3 |
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.1
|
7 |
+
Stable tag: 2.0
|
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 track AdSense clicks, add extra search engines, track image search queries and it will even work together with Urchin.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
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 track AdSense clicks, add extra search engines, track image search queries and it will even work together with Urchin.
|
14 |
|
15 |
In the options panel for the plugin, you can determine the prefixes to use for the different kinds of outbound links and downloads it tracks.
|
16 |
|