Version Description
Download this release
Release Info
Developer | cavemonkey50 |
Plugin | Google Analyticator |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.02 to 2.1
- google-analyticator.php +215 -222
- readme.txt +3 -3
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.
|
@@ -54,241 +54,234 @@ function add_ga_option_page() {
|
|
54 |
}
|
55 |
|
56 |
// wp_nonce
|
57 |
-
|
58 |
-
|
59 |
-
$ga_nonce = -1;
|
60 |
-
} else {
|
61 |
-
function ga_nonce_field($action = -1) { return wp_nonce_field($action); }
|
62 |
-
$ga_nonce = 'ga-update-key';
|
63 |
}
|
64 |
|
65 |
function ga_options_page() {
|
66 |
// If we are a postback, store the options
|
67 |
if (isset($_POST['info_update'])) {
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
// Update the extra tracking code
|
89 |
-
$ga_extra = $_POST[key_ga_extra];
|
90 |
-
update_option(key_ga_extra, $ga_extra);
|
91 |
-
|
92 |
-
// Update the extra after tracking code
|
93 |
-
$ga_extra_after = $_POST[key_ga_extra_after];
|
94 |
-
update_option(key_ga_extra_after, $ga_extra_after);
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
$ga_outbound = ga_outbound_default;
|
100 |
-
update_option(key_ga_outbound, $ga_outbound);
|
101 |
-
|
102 |
-
// Update the download tracking code
|
103 |
-
$ga_downloads = $_POST[key_ga_downloads];
|
104 |
-
update_option(key_ga_downloads, $ga_downloads);
|
105 |
-
|
106 |
-
// Update the footer
|
107 |
-
$ga_footer = $_POST[key_ga_footer];
|
108 |
-
if (($ga_footer != ga_enabled) && ($ga_footer != ga_disabled))
|
109 |
-
$ga_footer = ga_footer_default;
|
110 |
-
update_option(key_ga_footer, $ga_footer);
|
111 |
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
|
116 |
// Output the options page
|
117 |
?>
|
118 |
|
119 |
-
<form method="post" action="options-general.php?page=google-analyticator.php">
|
120 |
-
<?php ga_nonce_field('$ga_nonce', $ga_nonce); ?>
|
121 |
<div class="wrap">
|
|
|
|
|
122 |
<h2>Google Analyticator Options</h2>
|
123 |
-
<
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
<
|
136 |
-
<
|
137 |
-
<
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
<
|
159 |
-
<
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
</table>
|
173 |
-
</fieldset>
|
174 |
-
<fieldset class='options'>
|
175 |
-
<legend>Advanced Options</legend>
|
176 |
-
<table class="editform" cellspacing="2" cellpadding="5" width="100%">
|
177 |
-
<tr>
|
178 |
-
<th width="30%" valign="top" style="padding-top: 10px;">
|
179 |
-
<label for="<?php echo key_ga_admin ?>">WordPress admin logging:</label>
|
180 |
-
</th>
|
181 |
-
<td>
|
182 |
-
<?php
|
183 |
-
echo "<select name='".key_ga_admin."' id='".key_ga_admin."'>\n";
|
184 |
-
|
185 |
-
echo "<option value='".ga_enabled."'";
|
186 |
-
if(get_option(key_ga_admin) == ga_enabled)
|
187 |
-
echo " selected='selected'";
|
188 |
-
echo ">Enabled</option>\n";
|
189 |
-
|
190 |
-
echo "<option value='".ga_disabled."'";
|
191 |
-
if(get_option(key_ga_admin) == ga_disabled)
|
192 |
-
echo" selected='selected'";
|
193 |
-
echo ">Disabled</option>\n";
|
194 |
-
|
195 |
-
echo "</select>\n";
|
196 |
-
?>
|
197 |
-
<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 8 or higher. Your user level <?php if ( current_user_can('level_8') ) echo 'is at least 8'; else echo 'is less than 8'; ?>.</p>
|
198 |
-
</td>
|
199 |
-
</tr>
|
200 |
-
<tr>
|
201 |
-
<th width="30%" valign="top" style="padding-top: 10px;">
|
202 |
-
<label for="<?php echo key_ga_footer ?>">Footer tracking code:</label>
|
203 |
-
</th>
|
204 |
-
<td>
|
205 |
-
<?php
|
206 |
-
echo "<select name='".key_ga_footer."' id='".key_ga_footer."'>\n";
|
207 |
-
|
208 |
-
echo "<option value='".ga_enabled."'";
|
209 |
-
if(get_option(key_ga_footer) == ga_enabled)
|
210 |
-
echo " selected='selected'";
|
211 |
-
echo ">Enabled</option>\n";
|
212 |
-
|
213 |
-
echo "<option value='".ga_disabled."'";
|
214 |
-
if(get_option(key_ga_footer) == ga_disabled)
|
215 |
-
echo" selected='selected'";
|
216 |
-
echo ">Disabled</option>\n";
|
217 |
-
|
218 |
-
echo "</select>\n";
|
219 |
-
?>
|
220 |
-
<p style="margin: 5px 10px;">Enabling this option will insert the Google Analytics tracking code in your site's footer instead of your header. This will speed up your page loading if turned on. Not all themes support code in the footer, so if you turn this option on, be sure to check the Analytics code is still displayed on your site.</p>
|
221 |
-
</td>
|
222 |
-
</tr>
|
223 |
-
<tr>
|
224 |
-
<th width="30%" valign="top" style="padding-top: 10px;">
|
225 |
-
<label for="<?php echo key_ga_outbound ?>">Outbound link tracking:</label>
|
226 |
-
</th>
|
227 |
-
<td>
|
228 |
-
<?php
|
229 |
-
echo "<select name='".key_ga_outbound."' id='".key_ga_outbound."'>\n";
|
230 |
-
|
231 |
-
echo "<option value='".ga_enabled."'";
|
232 |
-
if(get_option(key_ga_outbound) == ga_enabled)
|
233 |
-
echo " selected='selected'";
|
234 |
-
echo ">Enabled</option>\n";
|
235 |
-
|
236 |
-
echo "<option value='".ga_disabled."'";
|
237 |
-
if(get_option(key_ga_outbound) == ga_disabled)
|
238 |
-
echo" selected='selected'";
|
239 |
-
echo ">Disabled</option>\n";
|
240 |
-
|
241 |
-
echo "</select>\n";
|
242 |
-
?>
|
243 |
-
<p style="margin: 5px 10px;">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>
|
244 |
-
</td>
|
245 |
-
</tr>
|
246 |
-
<tr>
|
247 |
-
<th valign="top" style="padding-top: 10px;">
|
248 |
-
<label for="<?php echo key_ga_downloads; ?>">Download extensions to track:</label>
|
249 |
-
</th>
|
250 |
-
<td>
|
251 |
-
<?php
|
252 |
-
echo "<input type='text' size='50' ";
|
253 |
-
echo "name='".key_ga_downloads."' ";
|
254 |
-
echo "id='".key_ga_downloads."' ";
|
255 |
-
echo "value='".stripslashes(get_option(key_ga_downloads))."' />\n";
|
256 |
-
?>
|
257 |
-
<p style="margin: 5px 10px;">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>
|
258 |
-
</td>
|
259 |
-
</tr>
|
260 |
-
<tr>
|
261 |
-
<th valign="top" style="padding-top: 10px;">
|
262 |
-
<label for="<?php echo key_ga_extra; ?>">Additional tracking code<br />(before tracker initialization):</label>
|
263 |
-
</th>
|
264 |
-
<td>
|
265 |
-
<?php
|
266 |
-
echo "<textarea cols='50' rows='8' ";
|
267 |
-
echo "name='".key_ga_extra."' ";
|
268 |
-
echo "id='".key_ga_extra."'>";
|
269 |
-
echo stripslashes(get_option(key_ga_extra))."</textarea>\n";
|
270 |
-
?>
|
271 |
-
<p style="margin: 5px 10px;">Enter any additional lines of tracking code that you would like to include in the Google Anayltics tracking script. The code in this section will be displayed <strong>before</strong> the Google Analytics tracker is initialized. Read <a href="http://www.google.com/analytics/InstallingGATrackingCode.pdf">Google Analytics tracker manual</a> to learn what code goes here and how to use it.</p>
|
272 |
-
</td>
|
273 |
-
</tr>
|
274 |
-
<tr>
|
275 |
-
<th valign="top" style="padding-top: 10px;">
|
276 |
-
<label for="<?php echo key_ga_extra_after; ?>">Additional tracking code<br />(after tracker initialization):</label>
|
277 |
-
</th>
|
278 |
-
<td>
|
279 |
-
<?php
|
280 |
-
echo "<textarea cols='50' rows='8' ";
|
281 |
-
echo "name='".key_ga_extra_after."' ";
|
282 |
-
echo "id='".key_ga_extra_after."'>";
|
283 |
-
echo stripslashes(get_option(key_ga_extra_after))."</textarea>\n";
|
284 |
-
?>
|
285 |
-
<p style="margin: 5px 10px;">Enter any additional lines of tracking code that you would like to include in the Google Anayltics tracking script. The code in this section will be displayed <strong>after</strong> the Google Analytics tracker is initialized. Read <a href="http://www.google.com/analytics/InstallingGATrackingCode.pdf">Google Analytics tracker manual</a> to learn what code goes here and how to use it.</p>
|
286 |
-
</td>
|
287 |
-
</tr>
|
288 |
-
</table>
|
289 |
-
</fieldset>
|
290 |
<p class="submit">
|
291 |
-
<input type='submit' name='info_update' value='
|
292 |
</p>
|
293 |
</div>
|
294 |
</form>
|
@@ -346,10 +339,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 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
* Plugin Name: Google Analyticator
|
4 |
+
* Version: 2.1
|
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.
|
54 |
}
|
55 |
|
56 |
// wp_nonce
|
57 |
+
function ga_nonce_field() {
|
58 |
+
echo "<input type='hidden' name='ga-nonce-key' value='" . wp_create_nonce('google-analyticator') . "' />";
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
function ga_options_page() {
|
62 |
// If we are a postback, store the options
|
63 |
if (isset($_POST['info_update'])) {
|
64 |
+
if ( wp_verify_nonce($_POST['ga-nonce-key'], 'google-analyticator') ) {
|
65 |
+
|
66 |
+
// Update the status
|
67 |
+
$ga_status = $_POST[key_ga_status];
|
68 |
+
if (($ga_status != ga_enabled) && ($ga_status != ga_disabled))
|
69 |
+
$ga_status = ga_status_default;
|
70 |
+
update_option(key_ga_status, $ga_status);
|
71 |
|
72 |
+
// Update the UID
|
73 |
+
$ga_uid = $_POST[key_ga_uid];
|
74 |
+
if ($ga_uid == '')
|
75 |
+
$ga_uid = ga_uid_default;
|
76 |
+
update_option(key_ga_uid, $ga_uid);
|
77 |
|
78 |
+
// Update the admin logging
|
79 |
+
$ga_admin = $_POST[key_ga_admin];
|
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];
|
86 |
+
update_option(key_ga_extra, $ga_extra);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
+
// Update the extra after tracking code
|
89 |
+
$ga_extra_after = $_POST[key_ga_extra_after];
|
90 |
+
update_option(key_ga_extra_after, $ga_extra_after);
|
91 |
+
|
92 |
+
// Update the outbound tracking
|
93 |
+
$ga_outbound = $_POST[key_ga_outbound];
|
94 |
+
if (($ga_outbound != ga_enabled) && ($ga_outbound != ga_disabled))
|
95 |
+
$ga_outbound = ga_outbound_default;
|
96 |
+
update_option(key_ga_outbound, $ga_outbound);
|
97 |
+
|
98 |
+
// Update the download tracking code
|
99 |
+
$ga_downloads = $_POST[key_ga_downloads];
|
100 |
+
update_option(key_ga_downloads, $ga_downloads);
|
101 |
+
|
102 |
+
// Update the footer
|
103 |
+
$ga_footer = $_POST[key_ga_footer];
|
104 |
+
if (($ga_footer != ga_enabled) && ($ga_footer != ga_disabled))
|
105 |
+
$ga_footer = ga_footer_default;
|
106 |
+
update_option(key_ga_footer, $ga_footer);
|
107 |
+
|
108 |
+
// Give an updated message
|
109 |
+
echo "<div class='updated fade'><p><strong>Google Analyticator settings saved.</strong></p></div>";
|
110 |
+
}
|
111 |
}
|
112 |
|
113 |
// Output the options page
|
114 |
?>
|
115 |
|
|
|
|
|
116 |
<div class="wrap">
|
117 |
+
<form method="post" action="options-general.php?page=google-analyticator.php">
|
118 |
+
<?php ga_nonce_field(); ?>
|
119 |
<h2>Google Analyticator Options</h2>
|
120 |
+
<h3>Basic Options</h3>
|
121 |
+
<?php if (get_option(key_ga_status) == ga_disabled) { ?>
|
122 |
+
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
123 |
+
Google Analytics integration is currently <strong>DISABLED</strong>.
|
124 |
+
</div>
|
125 |
+
<?php } ?>
|
126 |
+
<?php if ((get_option(key_ga_uid) == "XX-XXXXX-X") && (get_option(key_ga_status) != ga_disabled)) { ?>
|
127 |
+
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
128 |
+
Google Analytics integration is currently enabled, but you did not enter a UID. Tracking will not occur.
|
129 |
+
</div>
|
130 |
+
<?php } ?>
|
131 |
+
<table class="form-table" cellspacing="2" cellpadding="5" width="100%">
|
132 |
+
<tr>
|
133 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
134 |
+
<label for="<?php echo key_ga_status ?>">Google Analytics logging is:</label>
|
135 |
+
</th>
|
136 |
+
<td>
|
137 |
+
<?php
|
138 |
+
echo "<select name='".key_ga_status."' id='".key_ga_status."'>\n";
|
139 |
+
|
140 |
+
echo "<option value='".ga_enabled."'";
|
141 |
+
if(get_option(key_ga_status) == ga_enabled)
|
142 |
+
echo " selected='selected'";
|
143 |
+
echo ">Enabled</option>\n";
|
144 |
+
|
145 |
+
echo "<option value='".ga_disabled."'";
|
146 |
+
if(get_option(key_ga_status) == ga_disabled)
|
147 |
+
echo" selected='selected'";
|
148 |
+
echo ">Disabled</option>\n";
|
149 |
+
|
150 |
+
echo "</select>\n";
|
151 |
+
?>
|
152 |
+
</td>
|
153 |
+
</tr>
|
154 |
+
<tr>
|
155 |
+
<th valign="top" style="padding-top: 10px;">
|
156 |
+
<label for="<?php echo key_ga_uid; ?>">Your Google Analytics' UID:</label>
|
157 |
+
</th>
|
158 |
+
<td>
|
159 |
+
<?php
|
160 |
+
echo "<input type='text' size='50' ";
|
161 |
+
echo "name='".key_ga_uid."' ";
|
162 |
+
echo "id='".key_ga_uid."' ";
|
163 |
+
echo "value='".get_option(key_ga_uid)."' />\n";
|
164 |
+
?>
|
165 |
+
<p style="margin: 5px 10px;">Enter your Google Analytics' UID in this box. The UID is needed for Google Analytics to log your website stats. Your UID can be found by looking in the JavaScript Google Analytics gives you to put on your page. Look for your UID in between <strong>_uacct = "UA-11111-1";</strong> in the JavaScript. In this example you would put <strong>UA-11111-1</strong> in the UID box.</p>
|
166 |
+
</td>
|
167 |
+
</tr>
|
168 |
+
</table>
|
169 |
+
<h3>Advanced Options</h3>
|
170 |
+
<table class="form-table" cellspacing="2" cellpadding="5" width="100%">
|
171 |
+
<tr>
|
172 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
173 |
+
<label for="<?php echo key_ga_admin ?>">WordPress admin logging:</label>
|
174 |
+
</th>
|
175 |
+
<td>
|
176 |
+
<?php
|
177 |
+
echo "<select name='".key_ga_admin."' id='".key_ga_admin."'>\n";
|
178 |
+
|
179 |
+
echo "<option value='".ga_enabled."'";
|
180 |
+
if(get_option(key_ga_admin) == ga_enabled)
|
181 |
+
echo " selected='selected'";
|
182 |
+
echo ">Enabled</option>\n";
|
183 |
+
|
184 |
+
echo "<option value='".ga_disabled."'";
|
185 |
+
if(get_option(key_ga_admin) == ga_disabled)
|
186 |
+
echo" selected='selected'";
|
187 |
+
echo ">Disabled</option>\n";
|
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 8 or higher. Your user level <?php if ( current_user_can('level_8') ) echo 'is at least 8'; else echo 'is less than 8'; ?>.</p>
|
192 |
+
</td>
|
193 |
+
</tr>
|
194 |
+
<tr>
|
195 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
196 |
+
<label for="<?php echo key_ga_footer ?>">Footer tracking code:</label>
|
197 |
+
</th>
|
198 |
+
<td>
|
199 |
+
<?php
|
200 |
+
echo "<select name='".key_ga_footer."' id='".key_ga_footer."'>\n";
|
201 |
+
|
202 |
+
echo "<option value='".ga_enabled."'";
|
203 |
+
if(get_option(key_ga_footer) == ga_enabled)
|
204 |
+
echo " selected='selected'";
|
205 |
+
echo ">Enabled</option>\n";
|
206 |
+
|
207 |
+
echo "<option value='".ga_disabled."'";
|
208 |
+
if(get_option(key_ga_footer) == ga_disabled)
|
209 |
+
echo" selected='selected'";
|
210 |
+
echo ">Disabled</option>\n";
|
211 |
+
|
212 |
+
echo "</select>\n";
|
213 |
+
?>
|
214 |
+
<p style="margin: 5px 10px;">Enabling this option will insert the Google Analytics tracking code in your site's footer instead of your header. This will speed up your page loading if turned on. Not all themes support code in the footer, so if you turn this option on, be sure to check the Analytics code is still displayed on your site.</p>
|
215 |
+
</td>
|
216 |
+
</tr>
|
217 |
+
<tr>
|
218 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
219 |
+
<label for="<?php echo key_ga_outbound ?>">Outbound link tracking:</label>
|
220 |
+
</th>
|
221 |
+
<td>
|
222 |
+
<?php
|
223 |
+
echo "<select name='".key_ga_outbound."' id='".key_ga_outbound."'>\n";
|
224 |
+
|
225 |
+
echo "<option value='".ga_enabled."'";
|
226 |
+
if(get_option(key_ga_outbound) == ga_enabled)
|
227 |
+
echo " selected='selected'";
|
228 |
+
echo ">Enabled</option>\n";
|
229 |
+
|
230 |
+
echo "<option value='".ga_disabled."'";
|
231 |
+
if(get_option(key_ga_outbound) == ga_disabled)
|
232 |
+
echo" selected='selected'";
|
233 |
+
echo ">Disabled</option>\n";
|
234 |
+
|
235 |
+
echo "</select>\n";
|
236 |
+
?>
|
237 |
+
<p style="margin: 5px 10px;">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>
|
238 |
+
</td>
|
239 |
+
</tr>
|
240 |
+
<tr>
|
241 |
+
<th valign="top" style="padding-top: 10px;">
|
242 |
+
<label for="<?php echo key_ga_downloads; ?>">Download extensions to track:</label>
|
243 |
+
</th>
|
244 |
+
<td>
|
245 |
+
<?php
|
246 |
+
echo "<input type='text' size='50' ";
|
247 |
+
echo "name='".key_ga_downloads."' ";
|
248 |
+
echo "id='".key_ga_downloads."' ";
|
249 |
+
echo "value='".stripslashes(get_option(key_ga_downloads))."' />\n";
|
250 |
+
?>
|
251 |
+
<p style="margin: 5px 10px;">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>
|
252 |
+
</td>
|
253 |
+
</tr>
|
254 |
+
<tr>
|
255 |
+
<th valign="top" style="padding-top: 10px;">
|
256 |
+
<label for="<?php echo key_ga_extra; ?>">Additional tracking code<br />(before tracker initialization):</label>
|
257 |
+
</th>
|
258 |
+
<td>
|
259 |
+
<?php
|
260 |
+
echo "<textarea cols='50' rows='8' ";
|
261 |
+
echo "name='".key_ga_extra."' ";
|
262 |
+
echo "id='".key_ga_extra."'>";
|
263 |
+
echo stripslashes(get_option(key_ga_extra))."</textarea>\n";
|
264 |
+
?>
|
265 |
+
<p style="margin: 5px 10px;">Enter any additional lines of tracking code that you would like to include in the Google Anayltics tracking script. The code in this section will be displayed <strong>before</strong> the Google Analytics tracker is initialized. Read <a href="http://www.google.com/analytics/InstallingGATrackingCode.pdf">Google Analytics tracker manual</a> to learn what code goes here and how to use it.</p>
|
266 |
+
</td>
|
267 |
+
</tr>
|
268 |
+
<tr>
|
269 |
+
<th valign="top" style="padding-top: 10px;">
|
270 |
+
<label for="<?php echo key_ga_extra_after; ?>">Additional tracking code<br />(after tracker initialization):</label>
|
271 |
+
</th>
|
272 |
+
<td>
|
273 |
+
<?php
|
274 |
+
echo "<textarea cols='50' rows='8' ";
|
275 |
+
echo "name='".key_ga_extra_after."' ";
|
276 |
+
echo "id='".key_ga_extra_after."'>";
|
277 |
+
echo stripslashes(get_option(key_ga_extra_after))."</textarea>\n";
|
278 |
+
?>
|
279 |
+
<p style="margin: 5px 10px;">Enter any additional lines of tracking code that you would like to include in the Google Anayltics tracking script. The code in this section will be displayed <strong>after</strong> the Google Analytics tracker is initialized. Read <a href="http://www.google.com/analytics/InstallingGATrackingCode.pdf">Google Analytics tracker manual</a> to learn what code goes here and how to use it.</p>
|
280 |
+
</td>
|
281 |
+
</tr>
|
282 |
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
<p class="submit">
|
284 |
+
<input type='submit' name='info_update' value='Save Changes' />
|
285 |
</p>
|
286 |
</div>
|
287 |
</form>
|
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', -10);
|
343 |
+
add_filter('get_comment_author_link', 'ga_outgoing_comment_author', -10);
|
344 |
+
add_filter('the_content', 'ga_outgoing', -10);
|
345 |
+
add_filter('the_excerpt', 'ga_outgoing', -10);
|
346 |
}
|
347 |
}
|
348 |
}
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
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 |
-
Stable tag: 2.
|
8 |
|
9 |
Adds the necessary JavaScript code to enable Google Analytics.
|
10 |
|
2 |
Contributors: cavemonkey50
|
3 |
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.1
|
8 |
|
9 |
Adds the necessary JavaScript code to enable Google Analytics.
|
10 |
|