Version Description
Download this release
Release Info
Developer | cavemonkey50 |
Plugin | Google Analyticator |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.40 to 3.0
- external-tracking.js +23 -20
- google-analyticator.php +116 -69
- readme.txt +16 -150
external-tracking.js
CHANGED
@@ -1,23 +1,26 @@
|
|
1 |
-
jQuery(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
}
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
});
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
|
3 |
+
jQuery('a').each(function() {
|
4 |
+
var a = jQuery(this);
|
5 |
+
var href = a.attr('href');
|
6 |
+
var hrefArray = href.split('.').reverse();
|
7 |
+
var extension = hrefArray[0];
|
8 |
|
9 |
+
// If the link is external
|
10 |
+
if ( ( href.match(/^http/) ) && ( !href.match(document.domain) ) ) {
|
11 |
+
// Add the tracking code
|
12 |
+
a.click(function() {
|
13 |
+
pageTracker._trackPageview(outboundPrefix + href);
|
14 |
+
});
|
15 |
+
}
|
|
|
16 |
|
17 |
+
// If the link is a download
|
18 |
+
if (jQuery.inArray(extension,fileTypes) != -1) {
|
19 |
+
// Add the tracking code
|
20 |
+
a.click(function() {
|
21 |
+
pageTracker._trackPageview(downloadsPrefix + href);
|
22 |
+
});
|
23 |
+
}
|
24 |
+
});
|
25 |
+
|
26 |
});
|
google-analyticator.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Google Analyticator
|
4 |
-
* Version:
|
5 |
-
* Plugin URI: http://
|
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
|
7 |
-
* Author:
|
8 |
-
* Author URI: http://
|
9 |
*/
|
10 |
|
11 |
// Constants for enabled/disabled state
|
@@ -20,7 +20,9 @@ define("key_ga_admin_level", "ga_admin_level", true);
|
|
20 |
define("key_ga_extra", "ga_extra", true);
|
21 |
define("key_ga_extra_after", "ga_extra_after", true);
|
22 |
define("key_ga_outbound", "ga_outbound", true);
|
|
|
23 |
define("key_ga_downloads", "ga_downloads", true);
|
|
|
24 |
define("key_ga_footer", "ga_footer", true);
|
25 |
define("key_ga_specify_http", "ga_specify_http", true);
|
26 |
|
@@ -31,7 +33,9 @@ define("ga_admin_level_default", 8, true);
|
|
31 |
define("ga_extra_default", "", true);
|
32 |
define("ga_extra_after_default", "", true);
|
33 |
define("ga_outbound_default", ga_enabled, true);
|
|
|
34 |
define("ga_downloads_default", "", true);
|
|
|
35 |
define("ga_footer_default", ga_disabled, true);
|
36 |
define("ga_specify_http_default", "auto", true);
|
37 |
|
@@ -43,7 +47,9 @@ add_option(key_ga_admin_level, ga_admin_level_default, 'The level to consider a
|
|
43 |
add_option(key_ga_extra, ga_extra_default, 'Addition Google Analytics tracking options');
|
44 |
add_option(key_ga_extra_after, ga_extra_after_default, 'Addition Google Analytics tracking options');
|
45 |
add_option(key_ga_outbound, ga_outbound_default, 'Add tracking of outbound links');
|
|
|
46 |
add_option(key_ga_downloads, ga_downloads_default, 'Download extensions to track with Google Analyticator');
|
|
|
47 |
add_option(key_ga_footer, ga_footer_default, 'If Google Analyticator is outputting in the footer');
|
48 |
add_option(key_ga_specify_http, ga_specify_http_default, 'Automatically detect the http/https settings');
|
49 |
|
@@ -62,7 +68,9 @@ function ga_admin_init() {
|
|
62 |
register_setting('google-analyticator', key_ga_extra, '');
|
63 |
register_setting('google-analyticator', key_ga_extra_after, '');
|
64 |
register_setting('google-analyticator', key_ga_outbound, '');
|
|
|
65 |
register_setting('google-analyticator', key_ga_downloads, '');
|
|
|
66 |
register_setting('google-analyticator', key_ga_footer, '');
|
67 |
register_setting('google-analyticator', key_ga_specify_http, '');
|
68 |
}
|
@@ -74,7 +82,7 @@ add_action('init', 'ga_outgoing_links');
|
|
74 |
// Hook in the options page function
|
75 |
function add_ga_option_page() {
|
76 |
global $wpdb;
|
77 |
-
add_options_page('Google Analyticator
|
78 |
}
|
79 |
|
80 |
function ga_options_page() {
|
@@ -119,10 +127,22 @@ function ga_options_page() {
|
|
119 |
if (($ga_outbound != ga_enabled) && ($ga_outbound != ga_disabled))
|
120 |
$ga_outbound = ga_outbound_default;
|
121 |
update_option(key_ga_outbound, $ga_outbound);
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
// Update the download tracking code
|
124 |
$ga_downloads = $_POST[key_ga_downloads];
|
125 |
update_option(key_ga_downloads, $ga_downloads);
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
// Update the footer
|
128 |
$ga_footer = $_POST[key_ga_footer];
|
@@ -147,7 +167,12 @@ function ga_options_page() {
|
|
147 |
<div class="wrap">
|
148 |
<form method="post" action="options-general.php?page=google-analyticator.php">
|
149 |
<h2>Google Analyticator Settings</h2>
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
151 |
<?php if (get_option(key_ga_status) == ga_disabled) { ?>
|
152 |
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
153 |
Google Analytics integration is currently <strong>DISABLED</strong>.
|
@@ -196,7 +221,7 @@ function ga_options_page() {
|
|
196 |
</td>
|
197 |
</tr>
|
198 |
</table>
|
199 |
-
<h3>Advanced
|
200 |
<table class="form-table" cellspacing="2" cellpadding="5" width="100%">
|
201 |
<tr>
|
202 |
<th width="30%" valign="top" style="padding-top: 10px;">
|
@@ -295,6 +320,20 @@ function ga_options_page() {
|
|
295 |
<p style="margin: 5px 10px;" class="setting-description">Disabling this option will turn off the tracking of outbound links. It's recommended not to disable this option unless you're a privacy advocate (now why would you be using Google Analytics in the first place?) or it's causing some kind of weird issue.</p>
|
296 |
</td>
|
297 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
<tr>
|
299 |
<th valign="top" style="padding-top: 10px;">
|
300 |
<label for="<?php echo key_ga_downloads; ?>">Download extensions to track:</label>
|
@@ -309,6 +348,20 @@ function ga_options_page() {
|
|
309 |
<p style="margin: 5px 10px;" class="setting-description">Enter any extensions of files you would like to be tracked as a download. For example to track all MP3s and PDFs enter <strong>mp3,pdf</strong>. <em>Outbound link tracking must be enabled for downloads to be tracked.</em></p>
|
310 |
</td>
|
311 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
<tr>
|
313 |
<th valign="top" style="padding-top: 10px;">
|
314 |
<label for="<?php echo key_ga_extra; ?>">Additional tracking code<br />(before tracker initialization):</label>
|
@@ -391,50 +444,60 @@ function add_google_analytics() {
|
|
391 |
$extensions = str_replace (",", "|", get_option(key_ga_downloads));
|
392 |
|
393 |
// If GA is enabled and has a valid key
|
394 |
-
if ((get_option(key_ga_status) != ga_disabled) && ($uid != "XX-XXXXX-X")) {
|
395 |
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
echo "
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
} elseif ( get_option(key_ga_specify_http) == 'https' ) {
|
404 |
-
echo " <script type=\"text/javascript\" src=\"https://ssl.google-analytics.com/ga.js\"></script>\n\n";
|
405 |
-
} else {
|
406 |
-
echo " <script type=\"text/javascript\">\n";
|
407 |
-
echo " var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n";
|
408 |
-
echo " document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n";
|
409 |
-
echo " </script>\n\n";
|
410 |
-
}
|
411 |
-
|
412 |
echo " <script type=\"text/javascript\">\n";
|
413 |
-
echo "
|
414 |
-
echo "
|
415 |
-
|
416 |
-
// Insert extra before tracker code
|
417 |
-
if ( '' != $extra )
|
418 |
-
echo " " . $extra . "\n";
|
419 |
-
|
420 |
-
// Initialize the tracker
|
421 |
-
echo " pageTracker._initData();\n";
|
422 |
-
echo " pageTracker._trackPageview();\n";
|
423 |
-
|
424 |
-
// Insert extra after tracker code
|
425 |
-
if ( '' != $extra_after )
|
426 |
-
echo " " . $extra_after . "\n";
|
427 |
-
|
428 |
-
echo " } catch(err) {}</script>\n";
|
429 |
-
|
430 |
-
|
431 |
-
$extensions = explode(',', stripslashes(get_option(key_ga_downloads)));
|
432 |
-
foreach ( $extensions AS $extension )
|
433 |
-
$ext .= "'$extension',";
|
434 |
-
$ext = substr($ext, 0, -1); ?>
|
435 |
-
<script type="text/javascript">var fileTypes = [<?php echo $ext; ?>];</script>
|
436 |
-
<?php
|
437 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
}
|
439 |
}
|
440 |
|
@@ -445,12 +508,11 @@ function add_google_analytics() {
|
|
445 |
**/
|
446 |
function ga_outgoing_links()
|
447 |
{
|
448 |
-
// If
|
449 |
-
if (get_option(
|
450 |
-
// If
|
451 |
-
if (
|
452 |
add_action('wp_print_scripts', 'ga_external_tracking_js');
|
453 |
-
add_action('wp_head', 'ga_file_extensions');
|
454 |
}
|
455 |
}
|
456 |
}
|
@@ -466,19 +528,4 @@ function ga_external_tracking_js()
|
|
466 |
wp_enqueue_script('ga-external-tracking', plugins_url('/google-analyticator/external-tracking.js'));
|
467 |
}
|
468 |
|
469 |
-
/**
|
470 |
-
* Adds download tracking via jQuery to Google Analyticator
|
471 |
-
*
|
472 |
-
* @author Ronald Heft
|
473 |
-
**/
|
474 |
-
function ga_file_extensions()
|
475 |
-
{
|
476 |
-
$extensions = explode(',', stripslashes(get_option(key_ga_downloads)));
|
477 |
-
foreach ( $extensions AS $extension )
|
478 |
-
$ext .= "'$extensions',";
|
479 |
-
$ext = substr($ext, 0, -1);
|
480 |
-
?>
|
481 |
-
<script type="text/javascript">var fileTypes = [<?php echo $ext; ?>];</script>
|
482 |
-
<?php }
|
483 |
-
|
484 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Google Analyticator
|
4 |
+
* Version: 3.0
|
5 |
+
* Plugin URI: http://plugins.spiralwebconsulting.com/analyticator.html
|
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 settings page</a> and enter your Google Analytics' UID and enable logging.
|
7 |
+
* Author: Spiral Web Consulting
|
8 |
+
* Author URI: http://spiralwebconsulting.com/
|
9 |
*/
|
10 |
|
11 |
// Constants for enabled/disabled state
|
20 |
define("key_ga_extra", "ga_extra", true);
|
21 |
define("key_ga_extra_after", "ga_extra_after", true);
|
22 |
define("key_ga_outbound", "ga_outbound", true);
|
23 |
+
define("key_ga_outbound_prefix", "ga_outbound_prefix", true);
|
24 |
define("key_ga_downloads", "ga_downloads", true);
|
25 |
+
define("key_ga_downloads_prefix", "ga_downloads_prefix", true);
|
26 |
define("key_ga_footer", "ga_footer", true);
|
27 |
define("key_ga_specify_http", "ga_specify_http", true);
|
28 |
|
33 |
define("ga_extra_default", "", true);
|
34 |
define("ga_extra_after_default", "", true);
|
35 |
define("ga_outbound_default", ga_enabled, true);
|
36 |
+
define("ga_outbound_prefix_default", 'outgoing', true);
|
37 |
define("ga_downloads_default", "", true);
|
38 |
+
define("ga_downloads_prefix_default", "download", true);
|
39 |
define("ga_footer_default", ga_disabled, true);
|
40 |
define("ga_specify_http_default", "auto", true);
|
41 |
|
47 |
add_option(key_ga_extra, ga_extra_default, 'Addition Google Analytics tracking options');
|
48 |
add_option(key_ga_extra_after, ga_extra_after_default, 'Addition Google Analytics tracking options');
|
49 |
add_option(key_ga_outbound, ga_outbound_default, 'Add tracking of outbound links');
|
50 |
+
add_option(key_ga_outbound_prefix, ga_outbound_prefix_default, 'Add tracking of outbound links');
|
51 |
add_option(key_ga_downloads, ga_downloads_default, 'Download extensions to track with Google Analyticator');
|
52 |
+
add_option(key_ga_downloads_prefix, ga_downloads_prefix_default, 'Download extensions to track with Google Analyticator');
|
53 |
add_option(key_ga_footer, ga_footer_default, 'If Google Analyticator is outputting in the footer');
|
54 |
add_option(key_ga_specify_http, ga_specify_http_default, 'Automatically detect the http/https settings');
|
55 |
|
68 |
register_setting('google-analyticator', key_ga_extra, '');
|
69 |
register_setting('google-analyticator', key_ga_extra_after, '');
|
70 |
register_setting('google-analyticator', key_ga_outbound, '');
|
71 |
+
register_setting('google-analyticator', key_ga_outbound_prefix, '');
|
72 |
register_setting('google-analyticator', key_ga_downloads, '');
|
73 |
+
register_setting('google-analyticator', key_ga_downloads_prefix, '');
|
74 |
register_setting('google-analyticator', key_ga_footer, '');
|
75 |
register_setting('google-analyticator', key_ga_specify_http, '');
|
76 |
}
|
82 |
// Hook in the options page function
|
83 |
function add_ga_option_page() {
|
84 |
global $wpdb;
|
85 |
+
add_options_page('Google Analyticator Settings', 'Google Analytics', 8, basename(__FILE__), 'ga_options_page');
|
86 |
}
|
87 |
|
88 |
function ga_options_page() {
|
127 |
if (($ga_outbound != ga_enabled) && ($ga_outbound != ga_disabled))
|
128 |
$ga_outbound = ga_outbound_default;
|
129 |
update_option(key_ga_outbound, $ga_outbound);
|
130 |
+
|
131 |
+
// Update the outbound prefix
|
132 |
+
$ga_outbound_prefix = $_POST[key_ga_outbound_prefix];
|
133 |
+
if ($ga_outbound_prefix == '')
|
134 |
+
$ga_outbound_prefix = ga_outbound_prefix_default;
|
135 |
+
update_option(key_ga_outbound_prefix, $ga_outbound_prefix);
|
136 |
|
137 |
// Update the download tracking code
|
138 |
$ga_downloads = $_POST[key_ga_downloads];
|
139 |
update_option(key_ga_downloads, $ga_downloads);
|
140 |
+
|
141 |
+
// Update the download prefix
|
142 |
+
$ga_downloads_prefix = $_POST[key_ga_downloads_prefix];
|
143 |
+
if ($ga_downloads_prefix == '')
|
144 |
+
$ga_downloads_prefix = ga_downloads_prefix_default;
|
145 |
+
update_option(key_ga_downloads_prefix, $ga_downloads_prefix);
|
146 |
|
147 |
// Update the footer
|
148 |
$ga_footer = $_POST[key_ga_footer];
|
167 |
<div class="wrap">
|
168 |
<form method="post" action="options-general.php?page=google-analyticator.php">
|
169 |
<h2>Google Analyticator Settings</h2>
|
170 |
+
|
171 |
+
<p><em>
|
172 |
+
Google Analyticator is brought to you for free by <a href="http://spiralwebconsulting.com/">Spiral Web Consulting</a>. Spiral Web Consulting is a small web development firm specializing in PHP development. Visit our website to learn more, and don't hesitate to ask us to develop your next big WordPress plugin idea.
|
173 |
+
</em></p>
|
174 |
+
|
175 |
+
<h3>Basic Settings</h3>
|
176 |
<?php if (get_option(key_ga_status) == ga_disabled) { ?>
|
177 |
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
178 |
Google Analytics integration is currently <strong>DISABLED</strong>.
|
221 |
</td>
|
222 |
</tr>
|
223 |
</table>
|
224 |
+
<h3>Advanced Settings</h3>
|
225 |
<table class="form-table" cellspacing="2" cellpadding="5" width="100%">
|
226 |
<tr>
|
227 |
<th width="30%" valign="top" style="padding-top: 10px;">
|
320 |
<p style="margin: 5px 10px;" class="setting-description">Disabling this option will turn off the tracking of outbound links. It's recommended not to disable this option unless you're a privacy advocate (now why would you be using Google Analytics in the first place?) or it's causing some kind of weird issue.</p>
|
321 |
</td>
|
322 |
</tr>
|
323 |
+
<tr>
|
324 |
+
<th valign="top" style="padding-top: 10px;">
|
325 |
+
<label for="<?php echo key_ga_outbound_prefix; ?>">Prefix external links with:</label>
|
326 |
+
</th>
|
327 |
+
<td>
|
328 |
+
<?php
|
329 |
+
echo "<input type='text' size='50' ";
|
330 |
+
echo "name='".key_ga_outbound_prefix."' ";
|
331 |
+
echo "id='".key_ga_outbound_prefix."' ";
|
332 |
+
echo "value='".stripslashes(get_option(key_ga_outbound_prefix))."' />\n";
|
333 |
+
?>
|
334 |
+
<p style="margin: 5px 10px;" class="setting-description">Enter a name for the section tracked external links will appear under.</em></p>
|
335 |
+
</td>
|
336 |
+
</tr>
|
337 |
<tr>
|
338 |
<th valign="top" style="padding-top: 10px;">
|
339 |
<label for="<?php echo key_ga_downloads; ?>">Download extensions to track:</label>
|
348 |
<p style="margin: 5px 10px;" class="setting-description">Enter any extensions of files you would like to be tracked as a download. For example to track all MP3s and PDFs enter <strong>mp3,pdf</strong>. <em>Outbound link tracking must be enabled for downloads to be tracked.</em></p>
|
349 |
</td>
|
350 |
</tr>
|
351 |
+
<tr>
|
352 |
+
<th valign="top" style="padding-top: 10px;">
|
353 |
+
<label for="<?php echo key_ga_downloads_prefix; ?>">Prefix download links with:</label>
|
354 |
+
</th>
|
355 |
+
<td>
|
356 |
+
<?php
|
357 |
+
echo "<input type='text' size='50' ";
|
358 |
+
echo "name='".key_ga_downloads_prefix."' ";
|
359 |
+
echo "id='".key_ga_download_sprefix."' ";
|
360 |
+
echo "value='".stripslashes(get_option(key_ga_downloads_prefix))."' />\n";
|
361 |
+
?>
|
362 |
+
<p style="margin: 5px 10px;" class="setting-description">Enter a name for the section tracked download links will appear under.</em></p>
|
363 |
+
</td>
|
364 |
+
</tr>
|
365 |
<tr>
|
366 |
<th valign="top" style="padding-top: 10px;">
|
367 |
<label for="<?php echo key_ga_extra; ?>">Additional tracking code<br />(before tracker initialization):</label>
|
444 |
$extensions = str_replace (",", "|", get_option(key_ga_downloads));
|
445 |
|
446 |
// If GA is enabled and has a valid key
|
447 |
+
if ( (get_option(key_ga_status) != ga_disabled ) && ( $uid != "XX-XXXXX-X" )) {
|
448 |
|
449 |
+
echo "<!-- Google Analytics Tracking by Google Analyticator: http://plugins.spiralwebconsulting.com/analyticator.html -->\n";
|
450 |
+
// Pick the HTTP connection
|
451 |
+
if ( get_option(key_ga_specify_http) == 'http' ) {
|
452 |
+
echo " <script type=\"text/javascript\" src=\"http://www.google-analytics.com/ga.js\"></script>\n\n";
|
453 |
+
} elseif ( get_option(key_ga_specify_http) == 'https' ) {
|
454 |
+
echo " <script type=\"text/javascript\" src=\"https://ssl.google-analytics.com/ga.js\"></script>\n\n";
|
455 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
echo " <script type=\"text/javascript\">\n";
|
457 |
+
echo " var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n";
|
458 |
+
echo " document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n";
|
459 |
+
echo " </script>\n\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
}
|
461 |
+
|
462 |
+
echo " <script type=\"text/javascript\">\n";
|
463 |
+
echo " try {\n";
|
464 |
+
echo " var pageTracker = _gat._getTracker(\"$uid\");\n";
|
465 |
+
|
466 |
+
// Insert extra before tracker code
|
467 |
+
if ( '' != $extra )
|
468 |
+
echo " " . $extra . "\n";
|
469 |
+
|
470 |
+
// Initialize the tracker
|
471 |
+
echo " pageTracker._initData();\n";
|
472 |
+
echo " pageTracker._trackPageview();\n";
|
473 |
+
|
474 |
+
// Disable page tracking if admin is logged in
|
475 |
+
if ( ( get_option(key_ga_admin) == ga_disabled ) && ( current_user_can('level_' . get_option(key_ga_admin_level)) ) )
|
476 |
+
echo " pageTracker._setVar('admin');\n";
|
477 |
+
|
478 |
+
// Insert extra after tracker code
|
479 |
+
if ( '' != $extra_after )
|
480 |
+
echo " " . $extra_after . "\n";
|
481 |
+
|
482 |
+
echo " } catch(err) {}</script>\n";
|
483 |
+
|
484 |
+
// Include the file types to track
|
485 |
+
$extensions = explode(',', stripslashes(get_option(key_ga_downloads)));
|
486 |
+
foreach ( $extensions AS $extension )
|
487 |
+
$ext .= "'$extension',";
|
488 |
+
$ext = substr($ext, 0, -1);
|
489 |
+
|
490 |
+
// Include the link tracking prefixes
|
491 |
+
$outbound_prefix = stripslashes(get_option(key_ga_outbound_prefix));
|
492 |
+
$downloads_prefix = stripslashes(get_option(key_ga_downloads_prefix));
|
493 |
+
|
494 |
+
?>
|
495 |
+
<script type="text/javascript">
|
496 |
+
var fileTypes = [<?php echo $ext; ?>];
|
497 |
+
var outboundPrefix = '/<?php echo $outbound_prefix; ?>/';
|
498 |
+
var downloadsPrefix = '/<?php echo $downloads_prefix; ?>/';
|
499 |
+
</script>
|
500 |
+
<?php
|
501 |
}
|
502 |
}
|
503 |
|
508 |
**/
|
509 |
function ga_outgoing_links()
|
510 |
{
|
511 |
+
// If GA is enabled and has a valid key
|
512 |
+
if ( (get_option(key_ga_status) != ga_disabled ) && ( $uid != "XX-XXXXX-X" )) {
|
513 |
+
// If outbound tracking is enabled
|
514 |
+
if ( get_option(key_ga_outbound) == ga_enabled ) {
|
515 |
add_action('wp_print_scripts', 'ga_external_tracking_js');
|
|
|
516 |
}
|
517 |
}
|
518 |
}
|
528 |
wp_enqueue_script('ga-external-tracking', plugins_url('/google-analyticator/external-tracking.js'));
|
529 |
}
|
530 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
?>
|
readme.txt
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
=== Google Analyticator ===
|
2 |
-
Contributors: cavemonkey50
|
3 |
-
Donate link: http://cavemonkey50.com/code/
|
4 |
Tags: stats, google, analytics, tracking
|
5 |
-
Requires at least: 2.
|
6 |
Tested up to: 2.7
|
7 |
-
Stable tag:
|
8 |
|
9 |
Adds the necessary JavaScript code to enable Google Analytics.
|
10 |
|
@@ -12,160 +11,27 @@ Adds the necessary JavaScript code to enable Google Analytics.
|
|
12 |
|
13 |
Google Analyticator adds the necessary JavaScript code to enable Google Analytics logging on any WordPress blog. This eliminates the need to edit your template code to begin logging.
|
14 |
|
|
|
|
|
15 |
= Features =
|
16 |
|
17 |
Google Analyticator Has the Following Features:
|
18 |
|
19 |
-
-
|
20 |
-
-
|
21 |
-
-
|
22 |
-
-
|
23 |
-
-
|
24 |
-
-
|
25 |
-
-
|
26 |
-
-
|
27 |
-
- Complete control over options; disable any feature if needed.
|
28 |
-
|
29 |
-
= Usage =
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
Once you save your settings the JavaScript code should now be appearing on all of your WordPress pages.
|
34 |
|
35 |
== Installation ==
|
36 |
|
37 |
-
|
38 |
-
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
39 |
-
1. Configure your tracking settings through the 'Settings' > 'Google Analytics' menu in WordPress.
|
40 |
-
1. Watch Google Analytics for excellent information on your user base.
|
41 |
|
42 |
== Frequently Asked Questions ==
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
The Google Analytics code is added to the <head> section of your theme by default. It should be somewhere near the bottom of that section.
|
47 |
-
|
48 |
-
= Why don't I see the Google Analytics code on my website? =
|
49 |
-
|
50 |
-
If you have switched off admin logging, you will not see the code. You can try enabling it temporarily or log out of your WordPress account to see if the code is displaying.
|
51 |
-
|
52 |
-
= Why is Google saying my tracking code is not installed? =
|
53 |
-
|
54 |
-
Google's servers are slow at crawling for the tracking code. While the code may be visible on your site, it takes Google a number of days to realize it. The good news is hits are being recorded during this time; they just will not be visible until Google acknowledges your tracking code.
|
55 |
-
|
56 |
-
== Changelog ==
|
57 |
-
|
58 |
-
**2.40** - Minor Update
|
59 |
-
- Replaces the PHP-based external tracking solution with a jQuery-based one.
|
60 |
-
|
61 |
-
**2.3** - Minor Update
|
62 |
-
- Updates the Analytics script to match a change by Google. This should resolve the undefined _gat errors.
|
63 |
-
|
64 |
-
**2.24** - Critical Bug Fix
|
65 |
-
- Fixes comment author issues once and for all.
|
66 |
-
- Fixes a SVN merge issue that prevented people from getting the last update.
|
67 |
-
|
68 |
-
**2.23** - Bug Fix
|
69 |
-
- Reverting last version as it caused issues.
|
70 |
-
|
71 |
-
**2.22** - Bug Fix
|
72 |
-
- Improves comment author regex causing some issues in WordPress 2.7. Props jdub.
|
73 |
-
|
74 |
-
**2.21** - Minor Update
|
75 |
-
- Adds compatibility with WordPress 2.7.
|
76 |
-
|
77 |
-
**2.2** - Minor Update
|
78 |
-
- Adds an option to specify the GA script location instead of relying on Google's auto detect code. This may resolve the _gat is undefined errors.
|
79 |
-
|
80 |
-
**2.14** - Bug Fix
|
81 |
-
- Stops the external link tracking code from appearing in feeds, breaking feed validation.
|
82 |
-
- Adds compatibility for a very rare few users who could not save options.
|
83 |
-
|
84 |
-
**2.13** - Bug Fix
|
85 |
-
- Stops the external link tracking code from appearing in feeds, breaking feed validation.
|
86 |
-
|
87 |
-
**2.12** - Bug Fix
|
88 |
-
|
89 |
-
- Applies the new administrator level selection to outbound tracking (I forgot to that in the last release).
|
90 |
-
- Fixes a potential plugin conflict.
|
91 |
-
|
92 |
-
**2.11** - Minor Update
|
93 |
-
|
94 |
-
- Adds an option to change what Google Analyticator considers a WordPress administrator.
|
95 |
-
|
96 |
-
**2.1** - Minor Update
|
97 |
-
|
98 |
-
- Fixes a bug preventing options from being saved under WordPress 2.5.
|
99 |
-
- Updates option page to comply with WordPress 2.5 user interface changes.
|
100 |
-
- Note: Users of WordPress 2.3 may wish to stay on 2.02 as the UI will look 'weird' under 2.3.
|
101 |
-
|
102 |
-
**2.02** - Bug Fix
|
103 |
-
|
104 |
-
- Corrects potential XHTML validation issues with external link tracking.
|
105 |
-
|
106 |
-
**2.01** - Bug Fix
|
107 |
-
|
108 |
-
- Corrects XHTML validation issues with ga.js.
|
109 |
-
|
110 |
-
**2.0** - Major Update
|
111 |
-
|
112 |
-
- Adds support for the latest version of Google Analytics' tracking code (ga.js).
|
113 |
-
- Reverts external link/download tracking method back to writing the tracking code in the HTML source, due to the previous Javascript library no longer being support. Users of previous Google Analyticator versions may safely delete ga_external-links.js.
|
114 |
-
- Slightly modified the way extra code is handled. There are now two sections (before tracker initialization and after tracker initialization) to handle ga.js' extra functions. Refer to Google Analytics' support documentation for use of these sections.
|
115 |
-
|
116 |
-
**1.54** - Bug Fix
|
117 |
-
|
118 |
-
- Corrects problem where certain installation of WordPress do not have the user level value.
|
119 |
-
|
120 |
-
**1.53** - Bug Fix
|
121 |
-
|
122 |
-
- Finally fixes the "Are you sure?" bug some users experience.
|
123 |
-
|
124 |
-
**1.52** - Bug Fix
|
125 |
-
|
126 |
-
- Addresses compatibility issue with other JavaScript plugins.
|
127 |
-
|
128 |
-
**1.5** - Major Update
|
129 |
-
|
130 |
-
- Now using JavaScript solution for keeping track of external links instead of the current URL rewrite method. JavaScript library is courtesy of Terenzani.it.
|
131 |
-
- **IMPORTANT:** Google Analyticator is now in a folder. If upgrading from a version less than 1.5, delete google-analyticator.php from your /wp-content/plugins/ folder before proceeding.
|
132 |
-
|
133 |
-
**1.42** - Bug Fix
|
134 |
-
|
135 |
-
- Fixes a bug where outbound link tracking would be disabled if the tracking code was in the footer.
|
136 |
-
|
137 |
-
**1.41** - Minor Update
|
138 |
-
|
139 |
-
- Added an option to insert the tracking code in the footer instead of the header.
|
140 |
-
|
141 |
-
**1.4** - Major Update
|
142 |
-
|
143 |
-
- Adds support for download tracking.
|
144 |
-
|
145 |
-
**1.31** - Bug Fix
|
146 |
-
|
147 |
-
- Fixes a small bug with backslashes in the additional tracking code box.
|
148 |
-
|
149 |
-
**1.3** - Bug Fix
|
150 |
-
|
151 |
-
- WordPress 2.0 beta is now supported.
|
152 |
-
- Missing options page bug is finally fixed.
|
153 |
-
|
154 |
-
**1.2** - Major Update
|
155 |
-
|
156 |
-
- Added support for outbound links.
|
157 |
-
|
158 |
-
**1.12** - Bug Fix
|
159 |
-
|
160 |
-
- Try number two at fixing missing option page bug.
|
161 |
-
|
162 |
-
**1.11** - Bug Fix
|
163 |
-
|
164 |
-
- Hopefully fixed a bug where options page would sometimes not display.
|
165 |
-
|
166 |
-
**1.1** - Major Update
|
167 |
-
|
168 |
-
- Added an option to disable administrator logging.
|
169 |
-
- Added an option to add any additional tracking code that Google has.
|
170 |
-
|
171 |
-
**1.0** - Initial Release
|
1 |
=== Google Analyticator ===
|
2 |
+
Contributors: cavemonkey50, spiralwebconsulting
|
|
|
3 |
Tags: stats, google, analytics, tracking
|
4 |
+
Requires at least: 2.7
|
5 |
Tested up to: 2.7
|
6 |
+
Stable tag: 3.0
|
7 |
|
8 |
Adds the necessary JavaScript code to enable Google Analytics.
|
9 |
|
11 |
|
12 |
Google Analyticator adds the necessary JavaScript code to enable Google Analytics logging on any WordPress blog. This eliminates the need to edit your template code to begin logging.
|
13 |
|
14 |
+
*Google Analyticator is brought to you for free by [Spiral Web Consulting](http://spiralwebconsulting.com/). Spiral Web Consulting is a small web development firm specializing in PHP development. Visit our website to learn more, and don't hesitate to ask us to develop your next big WordPress plugin idea.*
|
15 |
+
|
16 |
= Features =
|
17 |
|
18 |
Google Analyticator Has the Following Features:
|
19 |
|
20 |
+
- Standard Google Analytics tracking support
|
21 |
+
- External link tracking of all links on the page, including links not managed by WordPress
|
22 |
+
- Download link tracking
|
23 |
+
- Support for hiding Administrator visits without effecting Google Analytics' site overlay feature
|
24 |
+
- Support for any advanced tracking code Google provides
|
25 |
+
- Easily installable only requiring the user knows their UID
|
26 |
+
- Allows code to be placed in the footer to ensure faster load times
|
27 |
+
- Complete control over options; disable any feature if needed
|
|
|
|
|
|
|
28 |
|
29 |
+
For more information, visiting the [Google Analyticator plugin page](http://plugins.spiralwebconsulting.com/analyticator.html).
|
|
|
|
|
30 |
|
31 |
== Installation ==
|
32 |
|
33 |
+
Please visit [Spiral Web Consulting's forum](http://plugins.spiralwebconsulting.com/forums/viewtopic.php?f=5&t=17) for installation information.
|
|
|
|
|
|
|
34 |
|
35 |
== Frequently Asked Questions ==
|
36 |
|
37 |
+
Please visit [Spiral Web Consulting's forum](http://plugins.spiralwebconsulting.com/forums/viewforum.php?f=5) for the latest FAQ information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|