Version Description
Async JS support
Download this release
Release Info
Developer | StatCounter |
Plugin | StatCounter – Free Real Time Visitor Stats |
Version | 2.0.4 |
Comparing to | |
See all releases |
Code changes from version 2.0.3 to 2.0.4
- StatCounter-Wordpress-Plugin.php +148 -154
- readme.txt +4 -4
StatCounter-Wordpress-Plugin.php
CHANGED
@@ -39,22 +39,22 @@ function statcounter_reports_load() {
|
|
39 |
}
|
40 |
|
41 |
function statcounter_reports_head() {
|
42 |
-
?>
|
43 |
-
<style type="text/css">
|
44 |
-
|
45 |
-
</style>
|
46 |
-
<?php
|
47 |
}
|
48 |
|
49 |
function statcounter_reports_page() {
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
<p>Your browser does not support iframes.</p>
|
59 |
</iframe>';
|
60 |
|
@@ -70,8 +70,8 @@ function add_sc_option_page() {
|
|
70 |
|
71 |
function sc_options_page() {
|
72 |
// If we are a postback, store the options
|
73 |
-
|
74 |
-
|
75 |
// Update the Project ID
|
76 |
$sc_project = trim($_POST[key_sc_project]);
|
77 |
if ($sc_project == '') {
|
@@ -85,7 +85,7 @@ function sc_options_page() {
|
|
85 |
$sc_security = sc_security_default;
|
86 |
}
|
87 |
update_option(key_sc_security, $sc_security);
|
88 |
-
|
89 |
// Update the position
|
90 |
$sc_position = $_POST[key_sc_position];
|
91 |
if (($sc_position != 'header') && ($sc_position != 'footer')) {
|
@@ -93,13 +93,13 @@ function sc_options_page() {
|
|
93 |
}
|
94 |
|
95 |
update_option(key_sc_position, $sc_position);
|
96 |
-
|
97 |
// Force invisibility
|
98 |
$sc_invisible = $_POST['sc_invisible'];
|
99 |
if ($sc_invisible == 1) {
|
100 |
-
update_option('sc_invisible', "1");
|
101 |
} else {
|
102 |
-
update_option('sc_invisible', "0");
|
103 |
}
|
104 |
|
105 |
// Give an updated message
|
@@ -109,98 +109,98 @@ function sc_options_page() {
|
|
109 |
// Output the options page
|
110 |
?>
|
111 |
|
112 |
-
|
113 |
<?php wp_nonce_field( 'update_sc_project_nonce', 'sc_project_nonce' ); ?>
|
114 |
<div class="wrap">
|
115 |
<?php if (get_option( key_sc_project ) == "0") { ?>
|
116 |
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
117 |
-
|
118 |
</div>
|
119 |
<?php } ?>
|
120 |
<h2>Using StatCounter</h2>
|
121 |
<blockquote><a href="http://statcounter.com" style="font-weight:bold;">StatCounter</a> is a free web traffic analysis service, which provides summary stats on all your traffic and a detailed analysis of your last 500 page views. This limit can be increased by upgrading to a paid service.</p>
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
<h2>StatCounter Options</h2>
|
127 |
<blockquote>
|
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 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
</blockquote>
|
195 |
-
|
196 |
<input type='submit' name='info_update' value='Update Options' />
|
197 |
</p>
|
198 |
</div>
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
|
203 |
-
|
|
|
|
|
204 |
}
|
205 |
|
206 |
$sc_position = get_option(key_sc_position);
|
@@ -214,74 +214,68 @@ if ($sc_position=="header") {
|
|
214 |
|
215 |
// The guts of the StatCounter script
|
216 |
function add_statcounter() {
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
?>
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
<?php
|
232 |
-
if($sc_invisible==1) {
|
233 |
-
|
234 |
-
}
|
235 |
-
|
236 |
-
define('HTTPS', isset($_SERVER['HTTPS']) && filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN));
|
237 |
-
$protocol = defined('HTTPS') ? "https:" : "http:";
|
238 |
-
|
239 |
-
?>
|
240 |
-
var scJsHost = (("https:" == document.location.protocol) ?
|
241 |
-
"https://secure." : "http://www.");
|
242 |
-
//-->
|
243 |
-
|
244 |
-
<?php
|
245 |
-
if($sc_invisible!=1) {
|
246 |
-
echo "\ndocument.write(\"<sc\"+\"ript src='\" +scJsHost +\"statcounter.com/counter/counter.js'></\"+\"script>\");";
|
247 |
-
}
|
248 |
-
?>
|
249 |
|
250 |
-
|
|
|
251 |
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
src=\"http://www.statcounter.com/counter/counter.js\"
|
258 |
async></script>";
|
259 |
-
|
260 |
-
|
261 |
src=\"https://secure.statcounter.com/counter/counter.js\"
|
262 |
async></script>";
|
|
|
|
|
|
|
|
|
|
|
263 |
}
|
264 |
-
}?>
|
265 |
-
|
266 |
-
<noscript><div class="statcounter"><a title="web analytics" href="<?php echo $protocol; ?>//statcounter.com/"><img class="statcounter" src="<?php echo $protocol; ?>//c.statcounter.com/<?php echo $sc_project; ?>/0/<?php echo $sc_security; ?>/<?php echo $sc_invisible; ?>/" alt="web analytics" /></a></div></noscript>
|
267 |
-
<!-- End of StatCounter Code -->
|
268 |
-
<?php
|
269 |
-
}
|
270 |
}
|
271 |
|
272 |
function addToTags($pid){
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
<script type="text/javascript">
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
}
|
286 |
?>
|
287 |
-
|
39 |
}
|
40 |
|
41 |
function statcounter_reports_head() {
|
42 |
+
?>
|
43 |
+
<style type="text/css">
|
44 |
+
body { height: 100%; }
|
45 |
+
</style>
|
46 |
+
<?php
|
47 |
}
|
48 |
|
49 |
function statcounter_reports_page() {
|
50 |
+
$sc_project = get_option(key_sc_project);
|
51 |
+
if($sc_project==0) {
|
52 |
+
$sc_link = '//statcounter.com/';
|
53 |
+
} else {
|
54 |
+
$sc_link = '//statcounter.com/p'.$sc_project.'/?source=wordpress';
|
55 |
+
}
|
56 |
+
|
57 |
+
echo '<iframe id="statcounter_frame" src="'.$sc_link.'" width="100%" height="2000">
|
58 |
<p>Your browser does not support iframes.</p>
|
59 |
</iframe>';
|
60 |
|
70 |
|
71 |
function sc_options_page() {
|
72 |
// If we are a postback, store the options
|
73 |
+
if ( isset( $_POST['info_update'] ) && check_admin_referer( 'update_sc_project_nonce', 'sc_project_nonce' ) ) {
|
74 |
+
|
75 |
// Update the Project ID
|
76 |
$sc_project = trim($_POST[key_sc_project]);
|
77 |
if ($sc_project == '') {
|
85 |
$sc_security = sc_security_default;
|
86 |
}
|
87 |
update_option(key_sc_security, $sc_security);
|
88 |
+
|
89 |
// Update the position
|
90 |
$sc_position = $_POST[key_sc_position];
|
91 |
if (($sc_position != 'header') && ($sc_position != 'footer')) {
|
93 |
}
|
94 |
|
95 |
update_option(key_sc_position, $sc_position);
|
96 |
+
|
97 |
// Force invisibility
|
98 |
$sc_invisible = $_POST['sc_invisible'];
|
99 |
if ($sc_invisible == 1) {
|
100 |
+
update_option('sc_invisible', "1");
|
101 |
} else {
|
102 |
+
update_option('sc_invisible', "0");
|
103 |
}
|
104 |
|
105 |
// Give an updated message
|
109 |
// Output the options page
|
110 |
?>
|
111 |
|
112 |
+
<form method="post" action="options-general.php?page=StatCounter-Wordpress-Plugin.php">
|
113 |
<?php wp_nonce_field( 'update_sc_project_nonce', 'sc_project_nonce' ); ?>
|
114 |
<div class="wrap">
|
115 |
<?php if (get_option( key_sc_project ) == "0") { ?>
|
116 |
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
117 |
+
StatCounter Plugin has been activated, but will not be enabled until you enter your <strong>Project ID</strong> and <strong>Security Code</strong>.
|
118 |
</div>
|
119 |
<?php } ?>
|
120 |
<h2>Using StatCounter</h2>
|
121 |
<blockquote><a href="http://statcounter.com" style="font-weight:bold;">StatCounter</a> is a free web traffic analysis service, which provides summary stats on all your traffic and a detailed analysis of your last 500 page views. This limit can be increased by upgrading to a paid service.</p>
|
122 |
+
<p>To activate the StatCounter service for your WordPress site:<ul>
|
123 |
+
<li><a href="http://statcounter.com/sign-up/" style="font-weight:bold;">Sign Up</a> with StatCounter or <a href="http://statcounter.com/add-project/" style="font-weight:bold;">add a new project</a> to your existing account</li>
|
124 |
+
<li>The installation process will detect your WordPress installation and provide you with your <strong>Project ID</strong> and <strong>Security Code</strong></li>
|
125 |
+
</ul></blockquote>
|
126 |
<h2>StatCounter Options</h2>
|
127 |
<blockquote>
|
128 |
+
<fieldset class='options'>
|
129 |
+
<table class="editform" cellspacing="2" cellpadding="5">
|
130 |
+
<tr>
|
131 |
+
<td>
|
132 |
+
<label for="<?php echo key_sc_project; ?>">Project ID:</label>
|
133 |
+
</td>
|
134 |
+
<td>
|
135 |
+
<?php
|
136 |
+
echo "<input type='text' size='11' ";
|
137 |
+
echo "name='".key_sc_project."' ";
|
138 |
+
echo "id='".key_sc_project."' ";
|
139 |
+
echo "value='".get_option(key_sc_project)."' />\n";
|
140 |
+
?>
|
141 |
+
</td>
|
142 |
+
</tr>
|
143 |
+
<tr>
|
144 |
+
<td>
|
145 |
+
<label for="<?php echo key_sc_security; ?>">Security Code:</label>
|
146 |
+
</td>
|
147 |
+
<td>
|
148 |
+
<?php
|
149 |
+
echo "<input type='text' size='9' ";
|
150 |
+
echo "name='".key_sc_security."' ";
|
151 |
+
echo "id='".key_sc_security."' ";
|
152 |
+
echo "value='".get_option(key_sc_security)."' />\n";
|
153 |
+
?>
|
154 |
+
</td>
|
155 |
+
</tr>
|
156 |
+
<tr>
|
157 |
+
<td>
|
158 |
+
<label for="<?php echo key_sc_position; ?>">Counter Position:</label>
|
159 |
+
</td>
|
160 |
+
<td>
|
161 |
+
<?php
|
162 |
+
echo "<select name='".key_sc_position."' id='".key_sc_position."'>\n";
|
163 |
+
|
164 |
+
echo "<option value='header'";
|
165 |
+
if(get_option(key_sc_position) == "header")
|
166 |
+
echo " selected='selected'";
|
167 |
+
echo ">Header</option>\n";
|
168 |
+
|
169 |
+
echo "<option value='footer'";
|
170 |
+
if(get_option(key_sc_position) != "header")
|
171 |
+
echo" selected='selected'";
|
172 |
+
echo ">Footer</option>\n";
|
173 |
+
|
174 |
+
echo "</select>\n";
|
175 |
+
?>
|
176 |
+
</td>
|
177 |
+
</tr>
|
178 |
+
<tr>
|
179 |
+
<td>
|
180 |
+
<label for="sc_invisible">Force invisibility:</label>
|
181 |
+
</td>
|
182 |
+
<td>
|
183 |
+
<?php
|
184 |
+
$checked = "";
|
185 |
+
if(get_option('sc_invisible')==1) {
|
186 |
+
$checked = "checked";
|
187 |
+
}
|
188 |
+
echo "<input type='checkbox' name='sc_invisible' id='sc_invisible' value='1' ".$checked.">\n";
|
189 |
+
?>
|
190 |
+
</td>
|
191 |
+
</tr>
|
192 |
+
</table>
|
193 |
+
</fieldset>
|
194 |
</blockquote>
|
195 |
+
<p class="submit">
|
196 |
<input type='submit' name='info_update' value='Update Options' />
|
197 |
</p>
|
198 |
</div>
|
199 |
+
</form>
|
|
|
|
|
200 |
|
201 |
+
|
202 |
+
|
203 |
+
<?php
|
204 |
}
|
205 |
|
206 |
$sc_position = get_option(key_sc_position);
|
214 |
|
215 |
// The guts of the StatCounter script
|
216 |
function add_statcounter() {
|
217 |
+
global $user_level;
|
218 |
+
$sc_project = get_option(key_sc_project);
|
219 |
+
$sc_security = get_option(key_sc_security);
|
220 |
+
$sc_invisible = 0;
|
221 |
+
$sc_invisible = get_option('sc_invisible');
|
222 |
+
if (
|
223 |
+
( $sc_project > 0 )
|
224 |
+
) {
|
225 |
+
?>
|
226 |
+
<!-- Start of StatCounter Code -->
|
227 |
+
<script>
|
228 |
+
<!--
|
229 |
+
var sc_project=<?php echo $sc_project; ?>;
|
230 |
+
var sc_security="<?php echo $sc_security; ?>";
|
231 |
+
<?php
|
232 |
+
if($sc_invisible==1) {
|
233 |
+
echo " var sc_invisible=1;\n";
|
234 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
+
define('HTTPS', isset($_SERVER['HTTPS']) && filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN));
|
237 |
+
$protocol = defined('HTTPS') ? "https:" : "http:";
|
238 |
|
239 |
+
?>
|
240 |
+
var scJsHost = (("https:" == document.location.protocol) ?
|
241 |
+
"https://secure." : "http://www.");
|
242 |
+
//-->
|
243 |
+
<?php
|
244 |
+
if($sc_invisible!=1) {
|
245 |
+
echo "\ndocument.write(\"<sc\"+\"ript src='\" +scJsHost +\"statcounter.com/counter/counter.js'></\"+\"script>\");";
|
246 |
+
}
|
247 |
+
?>
|
248 |
+
</script>
|
249 |
+
<?php
|
250 |
+
if($sc_invisible==1) {
|
251 |
+
if($protocol == "http:") {
|
252 |
+
echo "\n<script type=\"text/javascript\"
|
253 |
src=\"http://www.statcounter.com/counter/counter.js\"
|
254 |
async></script>";
|
255 |
+
} else if ($protocol == "https:"){
|
256 |
+
echo "\n<script type=\"text/javascript\"
|
257 |
src=\"https://secure.statcounter.com/counter/counter.js\"
|
258 |
async></script>";
|
259 |
+
}
|
260 |
+
}?>
|
261 |
+
<noscript><div class="statcounter"><a title="web analytics" href="<?php echo $protocol; ?>//statcounter.com/"><img class="statcounter" src="<?php echo $protocol; ?>//c.statcounter.com/<?php echo $sc_project; ?>/0/<?php echo $sc_security; ?>/<?php echo $sc_invisible; ?>/" alt="web analytics" /></a></div></noscript>
|
262 |
+
<!-- End of StatCounter Code -->
|
263 |
+
<?php
|
264 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
}
|
266 |
|
267 |
function addToTags($pid){
|
268 |
+
if (is_single()) {
|
269 |
+
global $post;
|
270 |
+
$queried_post = get_post($pid);
|
271 |
+
$authorId = $queried_post->post_author;
|
272 |
+
?>
|
273 |
<script type="text/javascript">
|
274 |
+
var _statcounter = _statcounter || [];
|
275 |
+
_statcounter.push({"tags": {"author": "<?php the_author_meta( 'nickname', $authorId); ?>"}});
|
276 |
+
</script>
|
277 |
+
<?php
|
278 |
+
|
279 |
+
}
|
280 |
}
|
281 |
?>
|
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: Aodhan Cullen
|
3 |
Donate link: http://statcounter.com/
|
4 |
Tags: web, statistics, stats, hit, counter, visitor, ip, tracker, analytics
|
5 |
-
Requires at least: 2.0.
|
6 |
Tested up to: 4.9.1
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -69,8 +69,8 @@ To activate the StatCounter service for your WordPress site:
|
|
69 |
2. Using the magnify tool, you can "zoom in" on individual visitors and get a detailed report on where they are from, their system settings, and most importantly, what link reffered them to your site and their navigation path through your site.
|
70 |
|
71 |
== Changelog ==
|
72 |
-
= 2.0.
|
73 |
-
Async
|
74 |
|
75 |
= 2.0.2 =
|
76 |
Compatibility enhancements
|
2 |
Contributors: Aodhan Cullen
|
3 |
Donate link: http://statcounter.com/
|
4 |
Tags: web, statistics, stats, hit, counter, visitor, ip, tracker, analytics
|
5 |
+
Requires at least: 2.0.2
|
6 |
Tested up to: 4.9.1
|
7 |
+
Stable tag: 2.0.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
69 |
2. Using the magnify tool, you can "zoom in" on individual visitors and get a detailed report on where they are from, their system settings, and most importantly, what link reffered them to your site and their navigation path through your site.
|
70 |
|
71 |
== Changelog ==
|
72 |
+
= 2.0.4 =
|
73 |
+
Async JS support
|
74 |
|
75 |
= 2.0.2 =
|
76 |
Compatibility enhancements
|