Version Description
Download this release
Release Info
Developer | joostdevalk |
Plugin | Google Analytics for WordPress by MonsterInsights |
Version | 2.7 |
Comparing to | |
See all releases |
Code changes from version 2.6.7 to 2.7
- adsense-track.js +0 -76
- googleanalytics.php +41 -15
- readme.txt +2 -1
adsense-track.js
DELETED
@@ -1,76 +0,0 @@
|
|
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 |
-
pageTracker._trackPageview('/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 |
-
pageTracker._trackPageview('/outbound/asclick');
|
74 |
-
}
|
75 |
-
}
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
googleanalytics.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Analytics for WordPress
|
|
4 |
Plugin URI: http://yoast.com/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.
|
8 |
Author URI: http://yoast.com/
|
9 |
License: GPL
|
10 |
|
@@ -63,7 +63,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
63 |
|
64 |
function config_page() {
|
65 |
global $dlextensions;
|
66 |
-
if ( $_GET['reset'] == "true") {
|
67 |
$options['dlextensions'] = 'doc,exe,.js,pdf,ppt,tgz,zip,xls';
|
68 |
$options['dlprefix'] = '/downloads';
|
69 |
$options['artprefix'] = '/outbound/article';
|
@@ -82,7 +82,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
82 |
check_admin_referer('analyticspp-config');
|
83 |
$options['uastring'] = $_POST['uastring'];
|
84 |
|
85 |
-
foreach (array('dlextensions', 'dlprefix', 'artprefix', 'comprefix', 'comautprefix', 'blogrollprefix', 'domainorurl') as $option_name) {
|
86 |
if (isset($_POST[$option_name])) {
|
87 |
$options[$option_name] = strtolower($_POST[$option_name]);
|
88 |
}
|
@@ -102,7 +102,6 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
102 |
|
103 |
update_option('GoogleAnalyticsPP', $options);
|
104 |
}
|
105 |
-
$mulch = ($uastring=""?"##-#####-#":$uastring);
|
106 |
|
107 |
$options = get_option('GoogleAnalyticsPP');
|
108 |
?>
|
@@ -206,13 +205,24 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
206 |
<label for="domainorurl">Track full URL of outbound clicks or just the domain?</label>
|
207 |
</th>
|
208 |
<td>
|
209 |
-
<select name="domainorurl" id="domainorurl">
|
210 |
<option value="domain"<?php if ($options['domainorurl'] == 'domain') { echo ' selected="selected"';} ?>>Just the domain</option>
|
211 |
<option value="url"<?php if ($options['domainorurl'] == 'url') { echo ' selected="selected"';} ?>>Track the complete URL</option>
|
212 |
</select>
|
213 |
</td>
|
214 |
</tr>
|
215 |
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
<tr>
|
217 |
<th scope="row" valign="top">
|
218 |
<label for="trackoutbound">Track outbound clicks<br/>
|
@@ -224,10 +234,11 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
224 |
</tr>
|
225 |
<tr>
|
226 |
<th scope="row" valign="top">
|
227 |
-
<label for="trackadsense">Track AdSense
|
|
|
228 |
</th>
|
229 |
<td>
|
230 |
-
<input type="checkbox" id="trackadsense" name="trackadsense" <?php if ($options['trackadsense']) echo ' checked="checked" '; ?>/>
|
231 |
</td>
|
232 |
</tr>
|
233 |
<tr>
|
@@ -359,10 +370,20 @@ if ( ! class_exists( 'GA_Filter' ) ) {
|
|
359 |
}
|
360 |
}
|
361 |
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
/* Create an array which contians:
|
367 |
* "domain" e.g. boakes.org
|
368 |
* "host" e.g. store.boakes.org
|
@@ -447,6 +468,8 @@ if ( ! class_exists( 'GA_Filter' ) ) {
|
|
447 |
}
|
448 |
|
449 |
function bookmarks($bookmarks) {
|
|
|
|
|
450 |
if (!is_admin() && (!current_user_can('edit_users') || $options['admintracking'] ) ) {
|
451 |
$options = get_option('GoogleAnalyticsPP');
|
452 |
|
@@ -501,11 +524,14 @@ if ($options['trackoutbound']) {
|
|
501 |
add_filter('get_comment_author_link', array('GA_Filter','comment_author_link'), 99);
|
502 |
}
|
503 |
|
504 |
-
// adds the footer so the javascript is loaded
|
505 |
-
add_action('wp_footer', array('GA_Filter','spool_analytics'));
|
506 |
-
|
507 |
if ($options['trackadsense']) {
|
508 |
-
add_action('
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
}
|
510 |
|
511 |
?>
|
4 |
Plugin URI: http://yoast.com/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.7
|
8 |
Author URI: http://yoast.com/
|
9 |
License: GPL
|
10 |
|
63 |
|
64 |
function config_page() {
|
65 |
global $dlextensions;
|
66 |
+
if ( isset($_GET['reset']) && $_GET['reset'] == "true") {
|
67 |
$options['dlextensions'] = 'doc,exe,.js,pdf,ppt,tgz,zip,xls';
|
68 |
$options['dlprefix'] = '/downloads';
|
69 |
$options['artprefix'] = '/outbound/article';
|
82 |
check_admin_referer('analyticspp-config');
|
83 |
$options['uastring'] = $_POST['uastring'];
|
84 |
|
85 |
+
foreach (array('dlextensions', 'dlprefix', 'artprefix', 'comprefix', 'comautprefix', 'blogrollprefix', 'domainorurl','position') as $option_name) {
|
86 |
if (isset($_POST[$option_name])) {
|
87 |
$options[$option_name] = strtolower($_POST[$option_name]);
|
88 |
}
|
102 |
|
103 |
update_option('GoogleAnalyticsPP', $options);
|
104 |
}
|
|
|
105 |
|
106 |
$options = get_option('GoogleAnalyticsPP');
|
107 |
?>
|
205 |
<label for="domainorurl">Track full URL of outbound clicks or just the domain?</label>
|
206 |
</th>
|
207 |
<td>
|
208 |
+
<select name="domainorurl" id="domainorurl" style="width:200px;">
|
209 |
<option value="domain"<?php if ($options['domainorurl'] == 'domain') { echo ' selected="selected"';} ?>>Just the domain</option>
|
210 |
<option value="url"<?php if ($options['domainorurl'] == 'url') { echo ' selected="selected"';} ?>>Track the complete URL</option>
|
211 |
</select>
|
212 |
</td>
|
213 |
</tr>
|
214 |
<?php } ?>
|
215 |
+
<tr>
|
216 |
+
<th scope="row" valign="top">
|
217 |
+
<label for="position">Track full URL of outbound clicks or just the domain?</label>
|
218 |
+
</th>
|
219 |
+
<td>
|
220 |
+
<select name="position" id="position" style="width:200px;">
|
221 |
+
<option value="footer"<?php if ($options['position'] == 'footer' || $options['position'] == "") { echo ' selected="selected"';} ?>>In the footer (default)</option>
|
222 |
+
<option value="header"<?php if ($options['position'] == 'header') { echo ' selected="selected"';} ?>>In the header</option>
|
223 |
+
</select>
|
224 |
+
</td>
|
225 |
+
</tr>
|
226 |
<tr>
|
227 |
<th scope="row" valign="top">
|
228 |
<label for="trackoutbound">Track outbound clicks<br/>
|
234 |
</tr>
|
235 |
<tr>
|
236 |
<th scope="row" valign="top">
|
237 |
+
<label for="trackadsense">Track AdSense</label><br/>
|
238 |
+
<small>This requires integration of your Analytics and AdSense account, for help, <a href="https://www.google.com/adsense/support/bin/topic.py?topic=15007">look here</a>.</small>
|
239 |
</th>
|
240 |
<td>
|
241 |
+
<input type="checkbox" id="trackadsense" name="trackadsense" <?php if ($options['trackadsense']) echo ' checked="checked" '; ?>/>
|
242 |
</td>
|
243 |
</tr>
|
244 |
<tr>
|
370 |
}
|
371 |
}
|
372 |
|
373 |
+
/*
|
374 |
+
* Insert the AdSense parameter code into the page. This'll go into the header per Google's instructions.
|
375 |
+
*/
|
376 |
+
function spool_adsense() {
|
377 |
+
$options = get_option('GoogleAnalyticsPP');
|
378 |
+
if ($options["uastring"] != "" && (!current_user_can('edit_users') || $options["admintracking"]) && !is_preview() ) { ?>
|
379 |
+
|
380 |
+
<script type="text/javascript">
|
381 |
+
window.google_analytics_uacct = "<?php echo $options["uastring"]; ?>";
|
382 |
+
</script>
|
383 |
+
<?php
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
/* Create an array which contians:
|
388 |
* "domain" e.g. boakes.org
|
389 |
* "host" e.g. store.boakes.org
|
468 |
}
|
469 |
|
470 |
function bookmarks($bookmarks) {
|
471 |
+
$options = get_option('GoogleAnalyticsPP');
|
472 |
+
|
473 |
if (!is_admin() && (!current_user_can('edit_users') || $options['admintracking'] ) ) {
|
474 |
$options = get_option('GoogleAnalyticsPP');
|
475 |
|
524 |
add_filter('get_comment_author_link', array('GA_Filter','comment_author_link'), 99);
|
525 |
}
|
526 |
|
|
|
|
|
|
|
527 |
if ($options['trackadsense']) {
|
528 |
+
add_action('wp_head', array('GA_Filter','spool_adsense'),10);
|
529 |
+
}
|
530 |
+
|
531 |
+
if ($options['position'] == 'footer' || $options['position'] == "") {
|
532 |
+
add_action('wp_footer', array('GA_Filter','spool_analytics'));
|
533 |
+
} else {
|
534 |
+
add_action('wp_head', array('GA_Filter','spool_analytics'),20);
|
535 |
}
|
536 |
|
537 |
?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://yoast.com/donate/
|
|
4 |
Tags: analytics, google analytics, statistics
|
5 |
Requires at least: 2.2
|
6 |
Tested up to: 2.7
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
The Google Analytics for WordPress plugin 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 |
|
@@ -29,6 +29,7 @@ This section describes how to install the plugin and get it working.
|
|
29 |
|
30 |
== Changelog ==
|
31 |
|
|
|
32 |
1. 2.6.6: Fixed settings link
|
33 |
1. 2.6.5: added Ozh admin menu icon and settings link
|
34 |
1. 2.6.4: fixes for 2.7
|
4 |
Tags: analytics, google analytics, statistics
|
5 |
Requires at least: 2.2
|
6 |
Tested up to: 2.7
|
7 |
+
Stable tag: 2.7
|
8 |
|
9 |
The Google Analytics for WordPress plugin 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 |
|
29 |
|
30 |
== Changelog ==
|
31 |
|
32 |
+
1. 2.7: Added option to select either header of footer position, added new AdSense integration options, remove now unneeded adsense tracking script.
|
33 |
1. 2.6.6: Fixed settings link
|
34 |
1. 2.6.5: added Ozh admin menu icon and settings link
|
35 |
1. 2.6.4: fixes for 2.7
|