Google Analyticator - Version 2.02

Version Description

Download this release

Release Info

Developer cavemonkey50
Plugin Icon 128x128 Google Analyticator
Version 2.02
Comparing to
See all releases

Code changes from version 2.01 to 2.02

Files changed (2) hide show
  1. google-analyticator.php +16 -8
  2. readme.txt +2 -2
google-analyticator.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/*
3
* Plugin Name: Google Analyticator
4
- * Version: 2.01
5
* Plugin URI: http://cavemonkey50.com/code/google-analyticator/
6
* Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin visit <a href="options-general.php?page=google-analyticator.php">the options page</a> and enter your Google Analytics' UID and enable logging.
7
* Author: Ronald Heft, Jr.
@@ -346,10 +346,10 @@ function add_google_analytics() {
346
function ga_outgoing_links() {
347
if (get_option(key_ga_outbound) == ga_enabled) {
348
if ((get_option(key_ga_admin) == ga_enabled) || ((get_option(key_ga_admin) == ga_disabled) && ( !current_user_can('level_8') ))) {
349
- add_filter('comment_text', 'ga_outgoing');
350
- add_filter('get_comment_author_link', 'ga_outgoing_comment_author');
351
- add_filter('the_content', 'ga_outgoing');
352
- add_filter('the_excerpt', 'ga_outgoing');
353
}
354
}
355
}
@@ -372,9 +372,9 @@ function ga_outgoing_comment_author($input) {
372
$target = ga_find_domain($matches[2]);
373
$local_host = ga_find_domain($_SERVER["HTTP_HOST"]);
374
if ( $target["domain"] != $local_host["domain"] ){
375
- $tracker_code .= " onclick=\"javascript:pageTracker._trackPageview ('/outbound/".$target["host"]."');\" ";
376
- }
377
- return $matches[1] . "\"" . $matches[2] . "\"" . $tracker_code . $matches[3];
378
}
379
380
// Takes a link and adds the Google outgoing tracking code
@@ -390,6 +390,14 @@ function ga_parse_link($matches){
390
$url = strtolower(substr(strrchr($url,"/"),1));
391
$tracker_code .= " onclick=\"javascript:pageTracker._trackPageview ('/downloads/".$file_extension."/".$url."');\"";
392
}
393
return '<a href="' . $matches[2] . '//' . $matches[3] . '"' . $matches[1] . $matches[4].$tracker_code.'>' . $matches[5] . '</a>';
394
}
395
1
<?php
2
/*
3
* Plugin Name: Google Analyticator
4
+ * Version: 2.02
5
* Plugin URI: http://cavemonkey50.com/code/google-analyticator/
6
* Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin visit <a href="options-general.php?page=google-analyticator.php">the options page</a> and enter your Google Analytics' UID and enable logging.
7
* Author: Ronald Heft, Jr.
346
function ga_outgoing_links() {
347
if (get_option(key_ga_outbound) == ga_enabled) {
348
if ((get_option(key_ga_admin) == ga_enabled) || ((get_option(key_ga_admin) == ga_disabled) && ( !current_user_can('level_8') ))) {
349
+ add_filter('comment_text', 'ga_outgoing', 1000);
350
+ add_filter('get_comment_author_link', 'ga_outgoing_comment_author', 1000);
351
+ add_filter('the_content', 'ga_outgoing', 1000);
352
+ add_filter('the_excerpt', 'ga_outgoing', 1000);
353
}
354
}
355
}
372
$target = ga_find_domain($matches[2]);
373
$local_host = ga_find_domain($_SERVER["HTTP_HOST"]);
374
if ( $target["domain"] != $local_host["domain"] ){
375
+ $tracker_code .= "onclick=\"javascript:pageTracker._trackPageview ('/outbound/".$target["host"]."');\"";
376
+ }
377
+ return $matches[1] . "\"" . $matches[2] . "\" " . $tracker_code . " " . $matches[3];
378
}
379
380
// Takes a link and adds the Google outgoing tracking code
390
$url = strtolower(substr(strrchr($url,"/"),1));
391
$tracker_code .= " onclick=\"javascript:pageTracker._trackPageview ('/downloads/".$file_extension."/".$url."');\"";
392
}
393
+ // Properly format additional code
394
+ if ( $matches[1] != '' ) {
395
+ $matches[1] = ' '. trim($matches[1]);
396
+ }
397
+ if ( $matches[4] != '' ) {
398
+ $matches[4] = ' '. trim($matches[4]);
399
+ }
400
+
401
return '<a href="' . $matches[2] . '//' . $matches[3] . '"' . $matches[1] . $matches[4].$tracker_code.'>' . $matches[5] . '</a>';
402
}
403
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Plugin Name ===
2
Contributors: cavemonkey50
3
Donate link: http://cavemonkey50.com/code/
4
Tags: stats, google, analytics, tracking
5
Requires at least: 2.0
6
Tested up to: 2.3
7
- Stable tag: 2.01
8
9
Adds the necessary JavaScript code to enable Google Analytics.
10
1
+ === Google Analyticator ===
2
Contributors: cavemonkey50
3
Donate link: http://cavemonkey50.com/code/
4
Tags: stats, google, analytics, tracking
5
Requires at least: 2.0
6
Tested up to: 2.3
7
+ Stable tag: 2.02
8
9
Adds the necessary JavaScript code to enable Google Analytics.
10