Version Description
Download this release
Release Info
Developer | joostdevalk |
Plugin | Google Analytics for WordPress by MonsterInsights |
Version | 2.9 |
Comparing to | |
See all releases |
Code changes from version 2.8 to 2.9
- account-id.png +0 -0
- googleanalytics.php +127 -82
- readme.txt +3 -2
- screenshot-1.png +0 -0
account-id.png
ADDED
Binary file
|
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 |
|
@@ -34,7 +34,8 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
34 |
function add_config_page() {
|
35 |
global $wpdb;
|
36 |
if ( function_exists('add_submenu_page') ) {
|
37 |
-
add_submenu_page('plugins.php', 'Google Analytics for WordPress Configuration', 'Google Analytics', 9, basename(__FILE__), array('GA_Admin','config_page'));
|
|
|
38 |
add_filter( 'plugin_action_links', array( 'GA_Admin', 'filter_plugin_actions'), 10, 2 );
|
39 |
add_filter( 'ozh_adminmenu_icon', array( 'GA_Admin', 'add_ozh_adminmenu_icon' ) );
|
40 |
}
|
@@ -61,9 +62,36 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
61 |
return $links;
|
62 |
}
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
function config_page() {
|
65 |
-
global $dlextensions;
|
66 |
-
if ( isset($
|
67 |
$options['dlextensions'] = 'doc,exe,.js,pdf,ppt,tgz,zip,xls';
|
68 |
$options['dlprefix'] = '/downloads';
|
69 |
$options['artprefix'] = '/outbound/article';
|
@@ -74,15 +102,19 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
74 |
$options['userv2'] = false;
|
75 |
$options['extrase'] = false;
|
76 |
$options['imagese'] = false;
|
|
|
77 |
$options['trackoutbound'] = true;
|
|
|
|
|
78 |
update_option('GoogleAnalyticsPP',$options);
|
|
|
79 |
}
|
80 |
if ( isset($_POST['submit']) ) {
|
81 |
if (!current_user_can('manage_options')) die(__('You cannot edit the Google Analytics for WordPress options.'));
|
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 |
}
|
@@ -101,6 +133,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
101 |
}
|
102 |
|
103 |
update_option('GoogleAnalyticsPP', $options);
|
|
|
104 |
}
|
105 |
|
106 |
$options = get_option('GoogleAnalyticsPP');
|
@@ -109,18 +142,6 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
109 |
<h2>Google Analytics for WordPress Configuration</h2>
|
110 |
<iframe style="float: right; width: 200px; height: 250px" src="http://yoast.com/wp/google-analytics.php"></iframe>
|
111 |
|
112 |
-
<script type="text/javascript">
|
113 |
-
function toggle_help(ele, ele2) {
|
114 |
-
var expl = document.getElementById(ele2);
|
115 |
-
if (expl.style.display == "block") {
|
116 |
-
expl.style.display = "none";
|
117 |
-
ele.innerHTML = "What's this?";
|
118 |
-
} else {
|
119 |
-
expl.style.display = "block";
|
120 |
-
ele.innerHTML = "Hide explanation";
|
121 |
-
}
|
122 |
-
}
|
123 |
-
</script>
|
124 |
<form action="" method="post" id="analytics-conf">
|
125 |
<table class="form-table" style="clear:none;">
|
126 |
<?php
|
@@ -129,31 +150,63 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
129 |
?>
|
130 |
<tr>
|
131 |
<th scope="row" style="width:250px;" valign="top">
|
132 |
-
<label for="uastring">Analytics
|
133 |
</th>
|
134 |
<td>
|
135 |
<input id="uastring" name="uastring" type="text" size="20" maxlength="40" value="<?php echo $options['uastring']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /><br/>
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
Profile" you are shown a Web Property ID, a number that starts with "UA-".
|
148 |
-
Copy paste that into the box above.</p>
|
149 |
-
<p>Once you have entered your User Account String in
|
150 |
-
the box above your pages will be trackable by
|
151 |
-
Google Analytics.</p>
|
152 |
</div>
|
153 |
</td>
|
154 |
-
</tr>
|
155 |
-
<?php if ($options['trackoutbound']) { ?>
|
156 |
<tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
<th scope="row" valign="top">
|
158 |
<label for="dlextensions">Extensions of files to track as downloads</label><br/>
|
159 |
<small>(If the extension is only two chars, prefix it with a dot, like '.js')</small>
|
@@ -162,7 +215,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
162 |
<input type="text" name="dlextensions" size="30" value="<?php echo $options['dlextensions']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
163 |
</td>
|
164 |
</tr>
|
165 |
-
<tr>
|
166 |
<th scope="row" valign="top">
|
167 |
<label for="dlprefix">Prefix for tracked downloads</label>
|
168 |
</th>
|
@@ -170,7 +223,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
170 |
<input type="text" id="dlprefix" name="dlprefix" size="30" value="<?php echo $options['dlprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
171 |
</td>
|
172 |
</tr>
|
173 |
-
<tr>
|
174 |
<th scope="row" valign="top">
|
175 |
<label for="artprefix">Prefix for outbound clicks from articles</label>
|
176 |
</th>
|
@@ -178,7 +231,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
178 |
<input type="text" id="artprefix" name="artprefix" size="30" value="<?php echo $options['artprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
179 |
</td>
|
180 |
</tr>
|
181 |
-
<tr>
|
182 |
<th scope="row" valign="top">
|
183 |
<label for="comprefix">Prefix for outbound clicks from within comments</label>
|
184 |
</th>
|
@@ -186,7 +239,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
186 |
<input type="text" id="comprefix" name="comprefix" size="30" value="<?php echo $options['comprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
187 |
</td>
|
188 |
</tr>
|
189 |
-
<tr>
|
190 |
<th scope="row" valign="top">
|
191 |
<label for="comautprefix">Prefix for outbound clicks from comment author links</label>
|
192 |
</th>
|
@@ -194,7 +247,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
194 |
<input type="text" id="comautprefix" name="comautprefix" size="30" value="<?php echo $options['comautprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
195 |
</td>
|
196 |
</tr>
|
197 |
-
<tr>
|
198 |
<th scope="row" valign="top">
|
199 |
<label for="blogrollprefix">Prefix for outbound clicks from blogroll links</label>
|
200 |
</th>
|
@@ -202,7 +255,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
202 |
<input type="text" id="blogrollprefix" name="blogrollprefix" size="30" value="<?php echo $options['blogrollprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
203 |
</td>
|
204 |
</tr>
|
205 |
-
<tr>
|
206 |
<th scope="row" valign="top">
|
207 |
<label for="domainorurl">Track full URL of outbound clicks or just the domain?</label>
|
208 |
</th>
|
@@ -213,28 +266,16 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
213 |
</select>
|
214 |
</td>
|
215 |
</tr>
|
216 |
-
|
217 |
-
<tr>
|
218 |
<th scope="row" valign="top">
|
219 |
-
<label for="
|
|
|
220 |
</th>
|
221 |
<td>
|
222 |
-
<
|
223 |
-
<option value="footer"<?php if ($options['position'] == 'footer' || $options['position'] == "") { echo ' selected="selected"';} ?>>In the footer (default)</option>
|
224 |
-
<option value="header"<?php if ($options['position'] == 'header') { echo ' selected="selected"';} ?>>In the header</option>
|
225 |
-
</select>
|
226 |
-
</td>
|
227 |
-
</tr>
|
228 |
-
<tr>
|
229 |
-
<th scope="row" valign="top">
|
230 |
-
<label for="trackoutbound">Track outbound clicks<br/>
|
231 |
-
& downloads</label>
|
232 |
-
</th>
|
233 |
-
<td>
|
234 |
-
<input type="checkbox" id="trackoutbound" name="trackoutbound" <?php if ($options['trackoutbound']) echo ' checked="checked" '; ?>/>
|
235 |
</td>
|
236 |
</tr>
|
237 |
-
<tr>
|
238 |
<th scope="row" valign="top">
|
239 |
<label for="trackadsense">Track AdSense</label><br/>
|
240 |
<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>
|
@@ -243,7 +284,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
243 |
<input type="checkbox" id="trackadsense" name="trackadsense" <?php if ($options['trackadsense']) echo ' checked="checked" '; ?>/>
|
244 |
</td>
|
245 |
</tr>
|
246 |
-
<tr>
|
247 |
<th scope="row" valign="top">
|
248 |
<label for="extrase">Track extra Search Engines</label>
|
249 |
</th>
|
@@ -251,16 +292,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
251 |
<input type="checkbox" id="extrase" name="extrase" <?php if ($options['extrase']) echo ' checked="checked" '; ?>/>
|
252 |
</td>
|
253 |
</tr>
|
254 |
-
<tr>
|
255 |
-
<th scope="row" valign="top">
|
256 |
-
<label for="admintracking">Track the administrator too</label><br/>
|
257 |
-
<small>(default is not to)</small>
|
258 |
-
</th>
|
259 |
-
<td>
|
260 |
-
<input type="checkbox" id="admintracking" name="admintracking" <?php if ($options['admintracking']) echo ' checked="checked" '; ?>/>
|
261 |
-
</td>
|
262 |
-
</tr>
|
263 |
-
<tr>
|
264 |
<th scope="row" valign="top">
|
265 |
<label for="userv2">I use Urchin too.</label>
|
266 |
</th>
|
@@ -268,7 +300,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
268 |
<input type="checkbox" id="userv2" name="userv2" <?php if ($options['userv2']) echo ' checked="checked" '; ?>/>
|
269 |
</td>
|
270 |
</tr>
|
271 |
-
<tr>
|
272 |
<th scope="row" valign="top">
|
273 |
<label for="allowanchor">Use # instead of ? for Campaign tracking?</label><br/>
|
274 |
<small>This adds a <a href="http://code.google.com/apis/analytics/docs/gaJSApiCampaignTracking.html#_gat.GA_Tracker_._setAllowAnchor">setAllowAnchor</a> call to your tracking script.</small>
|
@@ -279,8 +311,10 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
279 |
</tr>
|
280 |
</table>
|
281 |
<p style="border:0;" class="submit"><input type="submit" name="submit" value="Update Settings »" /></p>
|
282 |
-
|
283 |
-
|
|
|
|
|
284 |
</form>
|
285 |
</div>
|
286 |
<?php
|
@@ -317,7 +351,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
317 |
|
318 |
function success() {
|
319 |
echo "
|
320 |
-
<div id='analytics-warning' class='updated
|
321 |
<style type='text/css'>
|
322 |
#adminmenu { margin-bottom: 7em; }
|
323 |
#analytics-warning { position: absolute; top: 7em; }
|
@@ -326,7 +360,7 @@ if ( ! class_exists( 'GA_Admin' ) ) {
|
|
326 |
|
327 |
function warning() {
|
328 |
echo "
|
329 |
-
<div id='analytics-warning' class='updated
|
330 |
<style type='text/css'>
|
331 |
#adminmenu { margin-bottom: 6em; }
|
332 |
#analytics-warning { position: absolute; top: 7em; }
|
@@ -370,9 +404,14 @@ if ( ! class_exists( 'GA_Filter' ) ) {
|
|
370 |
}
|
371 |
if ( $options['allowanchor'] ) {
|
372 |
echo("\t\tpageTracker._setAllowAnchor(true);\n");
|
373 |
-
}
|
374 |
-
|
375 |
-
|
|
|
|
|
|
|
|
|
|
|
376 |
regex = new RegExp("images.google.([^\/]+).*&prev=([^&]+)");
|
377 |
var match = regex.exec(pageTracker.qa);
|
378 |
pageTracker.qa = "http://images.google." + match[1] + unescape(match[2]);
|
@@ -427,16 +466,21 @@ if ( $options['allowanchor'] ) {
|
|
427 |
$dlextensions = split(",",$options['dlextensions']);
|
428 |
if ( $target["domain"] != $origin["domain"] ){
|
429 |
if ($options['domainorurl'] == "domain") {
|
430 |
-
$coolBit .= "
|
431 |
} else if ($options['domainorurl'] == "url") {
|
432 |
-
$coolBit .= "
|
433 |
}
|
434 |
} else if ( in_array($extension, $dlextensions) && $target["domain"] == $origin["domain"] ) {
|
435 |
$file = str_replace($origin["domain"],"",$matches[3]);
|
436 |
$file = str_replace('www.',"",$file);
|
437 |
-
$coolBit .= "
|
438 |
}
|
439 |
-
|
|
|
|
|
|
|
|
|
|
|
440 |
}
|
441 |
|
442 |
function ga_parse_article_link($matches){
|
@@ -528,6 +572,7 @@ if ($options == "") {
|
|
528 |
|
529 |
// adds the menu item to the admin interface
|
530 |
add_action('admin_menu', array('GA_Admin','add_config_page'));
|
|
|
531 |
|
532 |
if ($options['trackoutbound']) {
|
533 |
// filters alter the existing content
|
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.9
|
8 |
Author URI: http://yoast.com/
|
9 |
License: GPL
|
10 |
|
34 |
function add_config_page() {
|
35 |
global $wpdb;
|
36 |
if ( function_exists('add_submenu_page') ) {
|
37 |
+
$plugin_page = add_submenu_page('plugins.php', 'Google Analytics for WordPress Configuration', 'Google Analytics', 9, basename(__FILE__), array('GA_Admin','config_page'));
|
38 |
+
add_action( 'admin_head-'. $plugin_page, array('GA_Admin','config_page_head') );
|
39 |
add_filter( 'plugin_action_links', array( 'GA_Admin', 'filter_plugin_actions'), 10, 2 );
|
40 |
add_filter( 'ozh_adminmenu_icon', array( 'GA_Admin', 'add_ozh_adminmenu_icon' ) );
|
41 |
}
|
62 |
return $links;
|
63 |
}
|
64 |
|
65 |
+
function config_page_head() {
|
66 |
+
wp_enqueue_script('jquery');
|
67 |
+
?>
|
68 |
+
<script type="text/javascript" charset="utf-8">
|
69 |
+
jQuery(document).ready(function(){
|
70 |
+
jQuery('#explanation td').css("display","none");
|
71 |
+
jQuery('#advancedsettings').change(function(){
|
72 |
+
if ((jQuery('#advancedsettings').attr('checked')) == true) {
|
73 |
+
jQuery('#advancedsettingstr').css("border-bottom","1px solid #333");
|
74 |
+
jQuery('.advanced th, .advanced td').css("display","table-cell");
|
75 |
+
} else {
|
76 |
+
jQuery('#advancedsettingstr').css("border-bottom","none");
|
77 |
+
jQuery('.advanced th, .advanced td').css("display","none");
|
78 |
+
}
|
79 |
+
}).change();
|
80 |
+
jQuery('#explain').click(function(){
|
81 |
+
if ((jQuery('#explanation td').css("display")) == "table-cell") {
|
82 |
+
jQuery('#explanation td').css("display","none");
|
83 |
+
} else {
|
84 |
+
jQuery('#explanation td').css("display","table-cell");
|
85 |
+
}
|
86 |
+
});
|
87 |
+
});
|
88 |
+
</script>
|
89 |
+
<?php
|
90 |
+
}
|
91 |
+
|
92 |
function config_page() {
|
93 |
+
global $dlextensions, $gapppluginpath;
|
94 |
+
if ( isset($_POST['reset']) && $_POST['reset'] == "true") {
|
95 |
$options['dlextensions'] = 'doc,exe,.js,pdf,ppt,tgz,zip,xls';
|
96 |
$options['dlprefix'] = '/downloads';
|
97 |
$options['artprefix'] = '/outbound/article';
|
102 |
$options['userv2'] = false;
|
103 |
$options['extrase'] = false;
|
104 |
$options['imagese'] = false;
|
105 |
+
$options['admintracking'] = true;
|
106 |
$options['trackoutbound'] = true;
|
107 |
+
$options['advancedsettings'] = false;
|
108 |
+
$options['allowanchor'] = false;
|
109 |
update_option('GoogleAnalyticsPP',$options);
|
110 |
+
echo "<div class=\"updated\"><p>Google Analytics settings reset to default.</p></div>\n";
|
111 |
}
|
112 |
if ( isset($_POST['submit']) ) {
|
113 |
if (!current_user_can('manage_options')) die(__('You cannot edit the Google Analytics for WordPress options.'));
|
114 |
check_admin_referer('analyticspp-config');
|
115 |
$options['uastring'] = $_POST['uastring'];
|
116 |
|
117 |
+
foreach (array('dlextensions', 'dlprefix', 'artprefix', 'comprefix', 'comautprefix', 'blogrollprefix', 'domainorurl','position','domain') as $option_name) {
|
118 |
if (isset($_POST[$option_name])) {
|
119 |
$options[$option_name] = strtolower($_POST[$option_name]);
|
120 |
}
|
133 |
}
|
134 |
|
135 |
update_option('GoogleAnalyticsPP', $options);
|
136 |
+
echo "<div id=\"message\" class=\"updated\"><p>Google Analytics settings updated.</p></div>\n";
|
137 |
}
|
138 |
|
139 |
$options = get_option('GoogleAnalyticsPP');
|
142 |
<h2>Google Analytics for WordPress Configuration</h2>
|
143 |
<iframe style="float: right; width: 200px; height: 250px" src="http://yoast.com/wp/google-analytics.php"></iframe>
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
<form action="" method="post" id="analytics-conf">
|
146 |
<table class="form-table" style="clear:none;">
|
147 |
<?php
|
150 |
?>
|
151 |
<tr>
|
152 |
<th scope="row" style="width:250px;" valign="top">
|
153 |
+
<label for="uastring">Analytics Account ID</label> <small><a href="#" id="explain">What's this?</a></small>
|
154 |
</th>
|
155 |
<td>
|
156 |
<input id="uastring" name="uastring" type="text" size="20" maxlength="40" value="<?php echo $options['uastring']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /><br/>
|
157 |
+
</td>
|
158 |
+
</tr>
|
159 |
+
<tr id="explanation">
|
160 |
+
<td colspan="2">
|
161 |
+
<div style="background: #fff; border: 1px solid #ccc; width: 60%; padding: 5px;">
|
162 |
+
<strong>Explanation</strong><br/>
|
163 |
+
Find the Account ID, starting with UA- in your account overview, as marked below:<br/>
|
164 |
+
<br/>
|
165 |
+
<img src="<?php echo $gapppluginpath ?>/account-id.png" alt="Account ID"/><br/>
|
166 |
+
<br/>
|
167 |
+
Once you have entered your Account ID in the box above your pages will be trackable by Google Analytics.
|
|
|
|
|
|
|
|
|
|
|
168 |
</div>
|
169 |
</td>
|
170 |
+
</tr>
|
|
|
171 |
<tr>
|
172 |
+
<th scope="row" valign="top">
|
173 |
+
<label for="position">Where should the tracking script be placed?</label>
|
174 |
+
</th>
|
175 |
+
<td>
|
176 |
+
<select name="position" id="position" style="width:200px;">
|
177 |
+
<option value="footer"<?php if ($options['position'] == 'footer' || $options['position'] == "") { echo ' selected="selected"';} ?>>In the footer (default)</option>
|
178 |
+
<option value="header"<?php if ($options['position'] == 'header') { echo ' selected="selected"';} ?>>In the header</option>
|
179 |
+
</select>
|
180 |
+
</td>
|
181 |
+
</tr>
|
182 |
+
<tr>
|
183 |
+
<th scope="row" valign="top">
|
184 |
+
<label for="trackoutbound">Track outbound clicks<br/>
|
185 |
+
& downloads</label>
|
186 |
+
</th>
|
187 |
+
<td>
|
188 |
+
<input type="checkbox" id="trackoutbound" name="trackoutbound" <?php if ($options['trackoutbound']) echo ' checked="checked" '; ?>/>
|
189 |
+
</td>
|
190 |
+
</tr>
|
191 |
+
<tr>
|
192 |
+
<th scope="row" valign="top">
|
193 |
+
<label for="advancedsettings">Show advanced settings</label><br/>
|
194 |
+
<small>Only adviced for advanced users who know their way around Google Analytics</small>
|
195 |
+
</th>
|
196 |
+
<td>
|
197 |
+
<input type="checkbox" id="advancedsettings" name="advancedsettings" <?php if ($options['advancedsettings']) echo ' checked="checked" '; ?>/>
|
198 |
+
</td>
|
199 |
+
</tr>
|
200 |
+
<tr class="advanced">
|
201 |
+
<th scope="row" valign="top">
|
202 |
+
<label for="admintracking">Track the administrator too</label><br/>
|
203 |
+
<small>(default is true)</small>
|
204 |
+
</th>
|
205 |
+
<td>
|
206 |
+
<input type="checkbox" id="admintracking" name="admintracking" <?php if ($options['admintracking']) echo ' checked="checked" '; ?>/>
|
207 |
+
</td>
|
208 |
+
</tr>
|
209 |
+
<tr class="advanced">
|
210 |
<th scope="row" valign="top">
|
211 |
<label for="dlextensions">Extensions of files to track as downloads</label><br/>
|
212 |
<small>(If the extension is only two chars, prefix it with a dot, like '.js')</small>
|
215 |
<input type="text" name="dlextensions" size="30" value="<?php echo $options['dlextensions']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
216 |
</td>
|
217 |
</tr>
|
218 |
+
<tr class="advanced">
|
219 |
<th scope="row" valign="top">
|
220 |
<label for="dlprefix">Prefix for tracked downloads</label>
|
221 |
</th>
|
223 |
<input type="text" id="dlprefix" name="dlprefix" size="30" value="<?php echo $options['dlprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
224 |
</td>
|
225 |
</tr>
|
226 |
+
<tr class="advanced">
|
227 |
<th scope="row" valign="top">
|
228 |
<label for="artprefix">Prefix for outbound clicks from articles</label>
|
229 |
</th>
|
231 |
<input type="text" id="artprefix" name="artprefix" size="30" value="<?php echo $options['artprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
232 |
</td>
|
233 |
</tr>
|
234 |
+
<tr class="advanced">
|
235 |
<th scope="row" valign="top">
|
236 |
<label for="comprefix">Prefix for outbound clicks from within comments</label>
|
237 |
</th>
|
239 |
<input type="text" id="comprefix" name="comprefix" size="30" value="<?php echo $options['comprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
240 |
</td>
|
241 |
</tr>
|
242 |
+
<tr class="advanced">
|
243 |
<th scope="row" valign="top">
|
244 |
<label for="comautprefix">Prefix for outbound clicks from comment author links</label>
|
245 |
</th>
|
247 |
<input type="text" id="comautprefix" name="comautprefix" size="30" value="<?php echo $options['comautprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
248 |
</td>
|
249 |
</tr>
|
250 |
+
<tr class="advanced">
|
251 |
<th scope="row" valign="top">
|
252 |
<label for="blogrollprefix">Prefix for outbound clicks from blogroll links</label>
|
253 |
</th>
|
255 |
<input type="text" id="blogrollprefix" name="blogrollprefix" size="30" value="<?php echo $options['blogrollprefix']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
256 |
</td>
|
257 |
</tr>
|
258 |
+
<tr class="advanced">
|
259 |
<th scope="row" valign="top">
|
260 |
<label for="domainorurl">Track full URL of outbound clicks or just the domain?</label>
|
261 |
</th>
|
266 |
</select>
|
267 |
</td>
|
268 |
</tr>
|
269 |
+
<tr class="advanced">
|
|
|
270 |
<th scope="row" valign="top">
|
271 |
+
<label for="domain">Domain Tracking</label><br/>
|
272 |
+
<small>This allows you to set the domain that's set by <a href="http://code.google.com/apis/analytics/docs/gaJSApiDomainDirectory.html#_gat.GA_Tracker_._setDomainName"><code>setDomainName</code></a> for tracking subdomains, if empty this will not be set.</small>
|
273 |
</th>
|
274 |
<td>
|
275 |
+
<input type="text" id="domain" name="domain" size="30" value="<?php echo $options['domain']; ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
</td>
|
277 |
</tr>
|
278 |
+
<tr class="advanced">
|
279 |
<th scope="row" valign="top">
|
280 |
<label for="trackadsense">Track AdSense</label><br/>
|
281 |
<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>
|
284 |
<input type="checkbox" id="trackadsense" name="trackadsense" <?php if ($options['trackadsense']) echo ' checked="checked" '; ?>/>
|
285 |
</td>
|
286 |
</tr>
|
287 |
+
<tr class="advanced">
|
288 |
<th scope="row" valign="top">
|
289 |
<label for="extrase">Track extra Search Engines</label>
|
290 |
</th>
|
292 |
<input type="checkbox" id="extrase" name="extrase" <?php if ($options['extrase']) echo ' checked="checked" '; ?>/>
|
293 |
</td>
|
294 |
</tr>
|
295 |
+
<tr class="advanced">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
<th scope="row" valign="top">
|
297 |
<label for="userv2">I use Urchin too.</label>
|
298 |
</th>
|
300 |
<input type="checkbox" id="userv2" name="userv2" <?php if ($options['userv2']) echo ' checked="checked" '; ?>/>
|
301 |
</td>
|
302 |
</tr>
|
303 |
+
<tr class="advanced">
|
304 |
<th scope="row" valign="top">
|
305 |
<label for="allowanchor">Use # instead of ? for Campaign tracking?</label><br/>
|
306 |
<small>This adds a <a href="http://code.google.com/apis/analytics/docs/gaJSApiCampaignTracking.html#_gat.GA_Tracker_._setAllowAnchor">setAllowAnchor</a> call to your tracking script.</small>
|
311 |
</tr>
|
312 |
</table>
|
313 |
<p style="border:0;" class="submit"><input type="submit" name="submit" value="Update Settings »" /></p>
|
314 |
+
</form>
|
315 |
+
<form action="" method="post">
|
316 |
+
<input type="hidden" name="reset" value="true"/>
|
317 |
+
<p style="border:0;" class="submit"><input type="submit" value="Reset Settings »" /></p>
|
318 |
</form>
|
319 |
</div>
|
320 |
<?php
|
351 |
|
352 |
function success() {
|
353 |
echo "
|
354 |
+
<div id='analytics-warning' class='updated'><p><strong>Congratulations! You have just activated Google Analytics.</p></div>
|
355 |
<style type='text/css'>
|
356 |
#adminmenu { margin-bottom: 7em; }
|
357 |
#analytics-warning { position: absolute; top: 7em; }
|
360 |
|
361 |
function warning() {
|
362 |
echo "
|
363 |
+
<div id='analytics-warning' class='updated-ff0000'><p><strong>Google Analytics is not active.</strong> You must <a href='plugins.php?page=googleanalytics.php'>enter your UA String</a> for it to work.</p></div>
|
364 |
<style type='text/css'>
|
365 |
#adminmenu { margin-bottom: 6em; }
|
366 |
#analytics-warning { position: absolute; top: 7em; }
|
404 |
}
|
405 |
if ( $options['allowanchor'] ) {
|
406 |
echo("\t\tpageTracker._setAllowAnchor(true);\n");
|
407 |
+
}
|
408 |
+
if ( isset($options['domain']) && $options['domain'] != "" ) {
|
409 |
+
if (substr($options['domain'],0,1) != ".") {
|
410 |
+
$options['domain'] = ".".$options['domain'];
|
411 |
+
}
|
412 |
+
echo("\t\tpageTracker._setDomainName(\"".$options['domain']."\");\n");
|
413 |
+
}
|
414 |
+
if (strpos($_SERVER['HTTP_REFERER'],"images.google") && strpos($_SERVER['HTTP_REFERER'],"&prev") && $options["imagese"]) { ?>
|
415 |
regex = new RegExp("images.google.([^\/]+).*&prev=([^&]+)");
|
416 |
var match = regex.exec(pageTracker.qa);
|
417 |
pageTracker.qa = "http://images.google." + match[1] + unescape(match[2]);
|
466 |
$dlextensions = split(",",$options['dlextensions']);
|
467 |
if ( $target["domain"] != $origin["domain"] ){
|
468 |
if ($options['domainorurl'] == "domain") {
|
469 |
+
$coolBit .= "javascript:pageTracker._trackPageview('".$leaf."/".$target["host"]."');";
|
470 |
} else if ($options['domainorurl'] == "url") {
|
471 |
+
$coolBit .= "javascript:pageTracker._trackPageview('".$leaf."/".$matches[2]."//".$matches[3]."');";
|
472 |
}
|
473 |
} else if ( in_array($extension, $dlextensions) && $target["domain"] == $origin["domain"] ) {
|
474 |
$file = str_replace($origin["domain"],"",$matches[3]);
|
475 |
$file = str_replace('www.',"",$file);
|
476 |
+
$coolBit .= "javascript:pageTracker._trackPageview('".$options['dlprefix'].$file."');";
|
477 |
}
|
478 |
+
if (preg_match('/onclick=[\'\"](.*?)[\'\"]/i', $matches[4]) > 0) {
|
479 |
+
$matches[4] = preg_replace('/onclick=[\'\"](.*?)[\'\"]/i', 'onclick="' . $coolBit .' $1"', $matches[4]);
|
480 |
+
} else {
|
481 |
+
$matches[4] = 'onclick="' . $coolBit . '"' . $matches[4];
|
482 |
+
}
|
483 |
+
return '<a ' . $matches[1] . 'href="' . $matches[2] . '//' . $matches[3] . '"' . ' ' . $matches[4] . '>' . $matches[5] . '</a>';
|
484 |
}
|
485 |
|
486 |
function ga_parse_article_link($matches){
|
572 |
|
573 |
// adds the menu item to the admin interface
|
574 |
add_action('admin_menu', array('GA_Admin','add_config_page'));
|
575 |
+
add_action('admin_menu', array('GA_Admin','add_config_page'));
|
576 |
|
577 |
if ($options['trackoutbound']) {
|
578 |
// filters alter the existing content
|
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.1
|
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 |
|
@@ -16,7 +16,7 @@ In the options panel for the plugin, you can determine the prefixes to use for t
|
|
16 |
|
17 |
* [Google Analytics for WordPress](http://yoast.com/wordpress/google-analytics/).
|
18 |
* Other [Wordpress plugins](http://yoast.com/wordpress/) by the same author.
|
19 |
-
*
|
20 |
|
21 |
== Installation ==
|
22 |
|
@@ -29,6 +29,7 @@ This section describes how to install the plugin and get it working.
|
|
29 |
|
30 |
== Changelog ==
|
31 |
|
|
|
32 |
1. 2.8: Added the option to add setAllowAnchor to the tracking code, allowing you to track campaigns with # instead of ?
|
33 |
1. 2.7: Added option to select either header of footer position, added new AdSense integration options, remove now unneeded adsense tracking script.
|
34 |
1. 2.6.6: Fixed settings link
|
4 |
Tags: analytics, google analytics, statistics
|
5 |
Requires at least: 2.2
|
6 |
Tested up to: 2.7.1
|
7 |
+
Stable tag: 2.9
|
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 |
|
16 |
|
17 |
* [Google Analytics for WordPress](http://yoast.com/wordpress/google-analytics/).
|
18 |
* Other [Wordpress plugins](http://yoast.com/wordpress/) by the same author.
|
19 |
+
* Check out the authors [WordPress Hosting](http://yoast.com/wordpress-hosting/) experience. Good hosting is hard to come by, but it doesn't have to be expensive, Joost tells you why!
|
20 |
|
21 |
== Installation ==
|
22 |
|
29 |
|
30 |
== Changelog ==
|
31 |
|
32 |
+
1. 2.9: Re arranged admin panel to have "standard" and "advanced" settigns, added domain tracking, added fix for double onclick parameter, as suggest here: http://wordpress.org/support/topic/241757
|
33 |
1. 2.8: Added the option to add setAllowAnchor to the tracking code, allowing you to track campaigns with # instead of ?
|
34 |
1. 2.7: Added option to select either header of footer position, added new AdSense integration options, remove now unneeded adsense tracking script.
|
35 |
1. 2.6.6: Fixed settings link
|
screenshot-1.png
CHANGED
Binary file
|