Version Description
Download this release
Release Info
Developer | cavemonkey50 |
Plugin | Google Analyticator |
Version | 2.11 |
Comparing to | |
See all releases |
Code changes from version 2.1 to 2.11
- google-analyticator.php +44 -7
- readme.txt +94 -8
google-analyticator.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Google Analyticator
|
4 |
-
* Version: 2.
|
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.
|
@@ -16,6 +16,7 @@ define("ga_disabled", "disabled", true);
|
|
16 |
define("key_ga_uid", "ga_uid", true);
|
17 |
define("key_ga_status", "ga_status", true);
|
18 |
define("key_ga_admin", "ga_admin_status", true);
|
|
|
19 |
define("key_ga_extra", "ga_extra", true);
|
20 |
define("key_ga_extra_after", "ga_extra_after", true);
|
21 |
define("key_ga_outbound", "ga_outbound", true);
|
@@ -25,6 +26,7 @@ define("key_ga_footer", "ga_footer", true);
|
|
25 |
define("ga_uid_default", "XX-XXXXX-X", true);
|
26 |
define("ga_status_default", ga_disabled, true);
|
27 |
define("ga_admin_default", ga_enabled, true);
|
|
|
28 |
define("ga_extra_default", "", true);
|
29 |
define("ga_extra_after_default", "", true);
|
30 |
define("ga_outbound_default", ga_enabled, true);
|
@@ -35,6 +37,7 @@ define("ga_footer_default", ga_disabled, true);
|
|
35 |
add_option(key_ga_status, ga_status_default, 'If Google Analytics logging in turned on or off.');
|
36 |
add_option(key_ga_uid, ga_uid_default, 'Your Google Analytics UID.');
|
37 |
add_option(key_ga_admin, ga_admin_default, 'If WordPress admins are counted in Google Analytics.');
|
|
|
38 |
add_option(key_ga_extra, ga_extra_default, 'Addition Google Analytics tracking options');
|
39 |
add_option(key_ga_extra_after, ga_extra_after_default, 'Addition Google Analytics tracking options');
|
40 |
add_option(key_ga_outbound, ga_outbound_default, 'Add tracking of outbound links');
|
@@ -80,6 +83,12 @@ function ga_options_page() {
|
|
80 |
if (($ga_admin != ga_enabled) && ($ga_admin != ga_disabled))
|
81 |
$ga_admin = ga_admin_default;
|
82 |
update_option(key_ga_admin, $ga_admin);
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
// Update the extra tracking code
|
85 |
$ga_extra = $_POST[key_ga_extra];
|
@@ -188,7 +197,35 @@ function ga_options_page() {
|
|
188 |
|
189 |
echo "</select>\n";
|
190 |
?>
|
191 |
-
<p style="margin: 5px 10px;">Disabling this option will prevent all logged in WordPress admins from showing up on your Google Analytics reports. A WordPress admin is defined as a user with a level
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
</td>
|
193 |
</tr>
|
194 |
<tr>
|
@@ -307,7 +344,7 @@ function add_google_analytics() {
|
|
307 |
if ((get_option(key_ga_status) != ga_disabled) && ($uid != "XX-XXXXX-X")) {
|
308 |
|
309 |
// Track if admin tracking is enabled or disabled and less than user level 8
|
310 |
-
if ((get_option(key_ga_admin) == ga_enabled) || ((get_option(key_ga_admin) == ga_disabled) && ( !current_user_can('
|
311 |
|
312 |
echo "<!-- Google Analytics Tracking by Google Analyticator: http://cavemonkey50.com/code/google-analyticator/ -->\n";
|
313 |
echo " <script type=\"text/javascript\">\n";
|
@@ -339,10 +376,10 @@ function add_google_analytics() {
|
|
339 |
function ga_outgoing_links() {
|
340 |
if (get_option(key_ga_outbound) == ga_enabled) {
|
341 |
if ((get_option(key_ga_admin) == ga_enabled) || ((get_option(key_ga_admin) == ga_disabled) && ( !current_user_can('level_8') ))) {
|
342 |
-
add_filter('comment_text', 'ga_outgoing',
|
343 |
-
add_filter('get_comment_author_link', 'ga_outgoing_comment_author',
|
344 |
-
add_filter('the_content', 'ga_outgoing',
|
345 |
-
add_filter('the_excerpt', 'ga_outgoing',
|
346 |
}
|
347 |
}
|
348 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Google Analyticator
|
4 |
+
* Version: 2.11
|
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.
|
16 |
define("key_ga_uid", "ga_uid", true);
|
17 |
define("key_ga_status", "ga_status", true);
|
18 |
define("key_ga_admin", "ga_admin_status", true);
|
19 |
+
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);
|
26 |
define("ga_uid_default", "XX-XXXXX-X", true);
|
27 |
define("ga_status_default", ga_disabled, true);
|
28 |
define("ga_admin_default", ga_enabled, true);
|
29 |
+
define("ga_admin_level_default", 8, true);
|
30 |
define("ga_extra_default", "", true);
|
31 |
define("ga_extra_after_default", "", true);
|
32 |
define("ga_outbound_default", ga_enabled, true);
|
37 |
add_option(key_ga_status, ga_status_default, 'If Google Analytics logging in turned on or off.');
|
38 |
add_option(key_ga_uid, ga_uid_default, 'Your Google Analytics UID.');
|
39 |
add_option(key_ga_admin, ga_admin_default, 'If WordPress admins are counted in Google Analytics.');
|
40 |
+
add_option(key_ga_admin_level, ga_admin_level_default, 'The level to consider a user a WordPress admin.');
|
41 |
add_option(key_ga_extra, ga_extra_default, 'Addition Google Analytics tracking options');
|
42 |
add_option(key_ga_extra_after, ga_extra_after_default, 'Addition Google Analytics tracking options');
|
43 |
add_option(key_ga_outbound, ga_outbound_default, 'Add tracking of outbound links');
|
83 |
if (($ga_admin != ga_enabled) && ($ga_admin != ga_disabled))
|
84 |
$ga_admin = ga_admin_default;
|
85 |
update_option(key_ga_admin, $ga_admin);
|
86 |
+
|
87 |
+
// Update the admin level
|
88 |
+
$ga_admin_level = $_POST[key_ga_admin_level];
|
89 |
+
if ( $ga_admin_level == '' )
|
90 |
+
$ga_admin_level = ga_admin_level_default;
|
91 |
+
update_option(key_ga_admin_level, $ga_admin_level);
|
92 |
|
93 |
// Update the extra tracking code
|
94 |
$ga_extra = $_POST[key_ga_extra];
|
197 |
|
198 |
echo "</select>\n";
|
199 |
?>
|
200 |
+
<p style="margin: 5px 10px;">Disabling this option will prevent all logged in WordPress admins from showing up on your Google Analytics reports. A WordPress admin is defined as a user with a level <?php
|
201 |
+
echo "<input type='text' size='2' ";
|
202 |
+
echo "name='".key_ga_admin_level."' ";
|
203 |
+
echo "id='".key_ga_admin_level."' ";
|
204 |
+
echo "value='".stripslashes(get_option(key_ga_admin_level))."' />\n";
|
205 |
+
?> or higher. Your user level is <?php
|
206 |
+
if ( current_user_can('level_10') )
|
207 |
+
echo '10';
|
208 |
+
elseif ( current_user_can('level_9') )
|
209 |
+
echo '9';
|
210 |
+
elseif ( current_user_can('level_8') )
|
211 |
+
echo '8';
|
212 |
+
elseif ( current_user_can('level_7') )
|
213 |
+
echo '7';
|
214 |
+
elseif ( current_user_can('level_6') )
|
215 |
+
echo '6';
|
216 |
+
elseif ( current_user_can('level_5') )
|
217 |
+
echo '5';
|
218 |
+
elseif ( current_user_can('level_4') )
|
219 |
+
echo '4';
|
220 |
+
elseif ( current_user_can('level_3') )
|
221 |
+
echo '3';
|
222 |
+
elseif ( current_user_can('level_2') )
|
223 |
+
echo '2';
|
224 |
+
elseif ( current_user_can('level_1') )
|
225 |
+
echo '1';
|
226 |
+
else
|
227 |
+
echo '0';
|
228 |
+
?>.</p>
|
229 |
</td>
|
230 |
</tr>
|
231 |
<tr>
|
344 |
if ((get_option(key_ga_status) != ga_disabled) && ($uid != "XX-XXXXX-X")) {
|
345 |
|
346 |
// Track if admin tracking is enabled or disabled and less than user level 8
|
347 |
+
if ((get_option(key_ga_admin) == ga_enabled) || ((get_option(key_ga_admin) == ga_disabled) && ( !current_user_can('level_' . get_option(key_ga_admin_level)) ))) {
|
348 |
|
349 |
echo "<!-- Google Analytics Tracking by Google Analyticator: http://cavemonkey50.com/code/google-analyticator/ -->\n";
|
350 |
echo " <script type=\"text/javascript\">\n";
|
376 |
function ga_outgoing_links() {
|
377 |
if (get_option(key_ga_outbound) == ga_enabled) {
|
378 |
if ((get_option(key_ga_admin) == ga_enabled) || ((get_option(key_ga_admin) == ga_disabled) && ( !current_user_can('level_8') ))) {
|
379 |
+
add_filter('comment_text', 'ga_outgoing', 1000);
|
380 |
+
add_filter('get_comment_author_link', 'ga_outgoing_comment_author', 1000);
|
381 |
+
add_filter('the_content', 'ga_outgoing', 1000);
|
382 |
+
add_filter('the_excerpt', 'ga_outgoing', 1000);
|
383 |
}
|
384 |
}
|
385 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://cavemonkey50.com/code/
|
|
4 |
Tags: stats, google, analytics, tracking
|
5 |
Requires at least: 2.3
|
6 |
Tested up to: 2.5
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Adds the necessary JavaScript code to enable Google Analytics.
|
10 |
|
@@ -12,7 +12,7 @@ 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 |
-
|
16 |
|
17 |
Google Analyticator Has the Following Features:
|
18 |
|
@@ -26,7 +26,7 @@ Google Analyticator Has the Following Features:
|
|
26 |
- Can include tracking code in the footer, speeding up load times.
|
27 |
- Complete control over options; disable any feature if needed.
|
28 |
|
29 |
-
|
30 |
|
31 |
In your WordPress administration page go to Options > Google Analytics. From there enter your UID and enable logging. Information on how to obtain your UID can be found on the options page.
|
32 |
|
@@ -34,18 +34,104 @@ Once you save your settings the JavaScript code should now be appearing on all o
|
|
34 |
|
35 |
== Installation ==
|
36 |
|
37 |
-
|
|
|
|
|
|
|
38 |
|
39 |
== Frequently Asked Questions ==
|
40 |
|
41 |
-
=Where is the Google Analytics code displayed
|
42 |
|
43 |
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.
|
44 |
|
45 |
-
=Why don
|
46 |
|
47 |
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.
|
48 |
|
49 |
-
=Why is Google saying my tracking code
|
50 |
|
51 |
-
Google
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
Tags: stats, google, analytics, tracking
|
5 |
Requires at least: 2.3
|
6 |
Tested up to: 2.5
|
7 |
+
Stable tag: 2.11
|
8 |
|
9 |
Adds the necessary JavaScript code to enable Google Analytics.
|
10 |
|
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 |
|
26 |
- Can include tracking code in the footer, speeding up load times.
|
27 |
- Complete control over options; disable any feature if needed.
|
28 |
|
29 |
+
= Usage =
|
30 |
|
31 |
In your WordPress administration page go to Options > Google Analytics. From there enter your UID and enable logging. Information on how to obtain your UID can be found on the options page.
|
32 |
|
34 |
|
35 |
== Installation ==
|
36 |
|
37 |
+
1. Upload the `google-analyticator` folder to your `/wp-content/plugins/` directory.
|
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 |
+
= Where is the Google Analytics code displayed? =
|
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.11** - Minor Update
|
59 |
+
|
60 |
+
- Adds an option to change what Google Analyticator considers a WordPress administrator.
|
61 |
+
|
62 |
+
**2.1** - Minor Update
|
63 |
+
|
64 |
+
- Fixes a bug preventing options from being saved under WordPress 2.5.
|
65 |
+
- Updates option page to comply with WordPress 2.5 user interface changes.
|
66 |
+
- Note: Users of WordPress 2.3 may wish to stay on 2.02 as the UI will look 'weird' under 2.3.
|
67 |
+
|
68 |
+
**2.02** - Bug Fix
|
69 |
+
|
70 |
+
- Corrects potential XHTML validation issues with external link tracking.
|
71 |
+
|
72 |
+
**2.01** - Bug Fix
|
73 |
+
|
74 |
+
- Corrects XHTML validation issues with ga.js.
|
75 |
+
|
76 |
+
**2.0** - Major Update
|
77 |
+
|
78 |
+
- Adds support for the latest version of Google Analytics' tracking code (ga.js).
|
79 |
+
- 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.
|
80 |
+
- 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.
|
81 |
+
|
82 |
+
**1.54** - Bug Fix
|
83 |
+
|
84 |
+
- Corrects problem where certain installation of WordPress do not have the user level value.
|
85 |
+
|
86 |
+
**1.53** - Bug Fix
|
87 |
+
|
88 |
+
- Finally fixes the "Are you sure?" bug some users experience.
|
89 |
+
|
90 |
+
**1.52** - Bug Fix
|
91 |
+
|
92 |
+
- Addresses compatibility issue with other JavaScript plugins.
|
93 |
+
|
94 |
+
**1.5** - Major Update
|
95 |
+
|
96 |
+
- Now using JavaScript solution for keeping track of external links instead of the current URL rewrite method. JavaScript library is courtesy of Terenzani.it.
|
97 |
+
- **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.
|
98 |
+
|
99 |
+
**1.42** - Bug Fix
|
100 |
+
|
101 |
+
- Fixes a bug where outbound link tracking would be disabled if the tracking code was in the footer.
|
102 |
+
|
103 |
+
**1.41** - Minor Update
|
104 |
+
|
105 |
+
- Added an option to insert the tracking code in the footer instead of the header.
|
106 |
+
|
107 |
+
**1.4** - Major Update
|
108 |
+
|
109 |
+
- Adds support for download tracking.
|
110 |
+
|
111 |
+
**1.31** - Bug Fix
|
112 |
+
|
113 |
+
- Fixes a small bug with backslashes in the additional tracking code box.
|
114 |
+
|
115 |
+
**1.3** - Bug Fix
|
116 |
+
|
117 |
+
- WordPress 2.0 beta is now supported.
|
118 |
+
- Missing options page bug is finally fixed.
|
119 |
+
|
120 |
+
**1.2** - Major Update
|
121 |
+
|
122 |
+
- Added support for outbound links.
|
123 |
+
|
124 |
+
**1.12** - Bug Fix
|
125 |
+
|
126 |
+
- Try number two at fixing missing option page bug.
|
127 |
+
|
128 |
+
**1.11** - Bug Fix
|
129 |
+
|
130 |
+
- Hopefully fixed a bug where options page would sometimes not display.
|
131 |
+
|
132 |
+
**1.1** - Major Update
|
133 |
+
|
134 |
+
- Added an option to disable administrator logging.
|
135 |
+
- Added an option to add any additional tracking code that Google has.
|
136 |
+
|
137 |
+
**1.0** - Initial Release
|