Version Description
- [New] Number of matches for local search result pages will now be tracked in the notes as 'results:X' where X is the number of matches found. You can also use the Filter Bar to find, for example, "all the search queries that had NO results". Cool, huh? (thank you, revisionsolar).
- [New] Browsers are starting to deprecate synchronous XHR requests, and they run the corresponding call asynchronously. This was causing our tracker to not record certain events as expected. We followed Google's lead and implemented the Beacon API in our code. Please make sure to clear your server caches to allow Slimstat to append the new tracker to your pages.
- [Update] The time to drop 'WP' from our plugin's name has come. Easier to remember, easier to find, easier to use. And yes, it will still remind you of that dietary supplement from the 80s.
- [Fix] Settings were not being saved correctly under certain specific circumstances, when add-ons were enabled.
- [Fix] Calls to admin-ajax.php were being tracked under certain circumstances.
- [Fix] The javascript code used to run various functions in the admin has been cleaned up and optimized.
Download this release
Release Info
Developer | coolmann |
Plugin | Slimstat Analytics |
Version | 4.4 |
Comparing to | |
See all releases |
Code changes from version 4.3.7 to 4.4
- admin/config/index.php +2 -3
- admin/css/slimstat.css +0 -1
- admin/js/slimstat.admin.js +18 -16
- admin/view/right-now.php +17 -2
- admin/wp-slimstat-admin.php +9 -59
- browscap/browser.php +0 -70
- readme.txt +15 -7
- wp-slimstat.js +46 -51
- wp-slimstat.min.js +1 -1
- wp-slimstat.php +38 -52
admin/config/index.php
CHANGED
@@ -106,7 +106,6 @@ $settings = array(
|
|
106 |
'filters_outbound_header' => array( 'description' => __( 'Link Tracking', 'wp-slimstat' ), 'type' => 'section_header' ),
|
107 |
'enable_outbound_tracking' => array( 'description' => __( 'Track Outbound Clicks', 'wp-slimstat' ), 'type' => 'toggle', 'long_description' => __('Track when your visitors click on link to external websites. This option required Spy Mode to be enabled.','wp-slimstat') ),
|
108 |
'track_internal_links' => array( 'description' => __( 'Track Internal Clicks', 'wp-slimstat' ), 'type' => 'toggle', 'long_description' => __( "Collect mouse coordinates and other information for clicks on internal links. Recommended if you're using our heatmap add-on. By default, this information is only collected for external links.", 'wp-slimstat' ) ),
|
109 |
-
'async_tracker' => array( 'description' => __( 'Async Tracker', 'wp-slimstat' ), 'type' => 'toggle', 'long_description' => __( "When the tracker is configured to record clicks on internal and / or outbound links, it needs to send this information back to the server <strong>before</strong> loading the actual page. This can result in a noticeable delay when someone clicks on one of your links, if your server takes a while to acknowledge the receipt of that information. You can set this option to instruct the tracker not to wait for the server, and load the target URL right away. This will remove the delay, but it might result in a less accurate logging of events. You can check your server latency under Site Analysis > Your Website. Values under 1000 milliseconds might allow you to use async mode.", 'wp-slimstat' ) ),
|
110 |
'ignore_outbound_classes_rel_href' => array( 'description' => __( 'No Callback', 'wp-slimstat' ), 'type' => 'textarea', 'long_description' => __( "Track the event but do not invoke the callback function on links marked with one of these class names, <em>rel</em> attribute or whose <em>href</em> attribute contains one of these strings. Useful to prevent conflicts with lightbox and similar libraries.", 'wp-slimstat' ) ),
|
111 |
'do_not_track_outbound_classes_rel_href' => array( 'description' => __( 'Do Not Track', 'wp-slimstat' ), 'type' => 'textarea', 'long_description' => __( "The tracker will ignore links marked with one of these class names, <em>rel</em> attributes or whose <em>href</em> attribute contains one of these strings.", 'wp-slimstat' ) ),
|
112 |
|
@@ -130,8 +129,8 @@ $settings = array(
|
|
130 |
</script>
|
131 |
<script type="text/javascript" src="http://cdn.jsdelivr.net/wp/wp-slimstat/trunk/wp-slimstat.js"></script>', 'use_tag_list' => false ),
|
132 |
'external_domains' => array('description' => __('Allow Domains','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("If you are getting an error saying that no 'Access-Control-Allow-Origin' header is present on the requested resource, when using the external tracking code here above, list the domains (complete with scheme) you would like to allow. For example: <code>http://my.domain.ext</code> (no trailing slash). Please see <a href='http://www.w3.org/TR/cors/#security' target='_blank'>this W3 resource</a> for more information on the security implications of allowing CORS requests.",'wp-slimstat')),
|
133 |
-
'advanced_misc_header' => array('description' => __('Miscellaneous','wp-slimstat'), 'type' => 'section_header'),
|
134 |
-
'enable_ads_network' => array('description' => __('Enable UAN','wp-slimstat'), 'type' => 'toggle', 'long_description' => __("Send anonymous data about user agents to our server for analysis. This allows us to contribute to the <a href='http://browscap.org/' target='_blank'>BrowsCap opensource project</a>, and improve the accuracy of Slimstat's browser detection functionality. It also enables our transparent ads network. No worries, your site will not be affected in any way.",'wp-slimstat'))
|
135 |
)
|
136 |
),
|
137 |
|
106 |
'filters_outbound_header' => array( 'description' => __( 'Link Tracking', 'wp-slimstat' ), 'type' => 'section_header' ),
|
107 |
'enable_outbound_tracking' => array( 'description' => __( 'Track Outbound Clicks', 'wp-slimstat' ), 'type' => 'toggle', 'long_description' => __('Track when your visitors click on link to external websites. This option required Spy Mode to be enabled.','wp-slimstat') ),
|
108 |
'track_internal_links' => array( 'description' => __( 'Track Internal Clicks', 'wp-slimstat' ), 'type' => 'toggle', 'long_description' => __( "Collect mouse coordinates and other information for clicks on internal links. Recommended if you're using our heatmap add-on. By default, this information is only collected for external links.", 'wp-slimstat' ) ),
|
|
|
109 |
'ignore_outbound_classes_rel_href' => array( 'description' => __( 'No Callback', 'wp-slimstat' ), 'type' => 'textarea', 'long_description' => __( "Track the event but do not invoke the callback function on links marked with one of these class names, <em>rel</em> attribute or whose <em>href</em> attribute contains one of these strings. Useful to prevent conflicts with lightbox and similar libraries.", 'wp-slimstat' ) ),
|
110 |
'do_not_track_outbound_classes_rel_href' => array( 'description' => __( 'Do Not Track', 'wp-slimstat' ), 'type' => 'textarea', 'long_description' => __( "The tracker will ignore links marked with one of these class names, <em>rel</em> attributes or whose <em>href</em> attribute contains one of these strings.", 'wp-slimstat' ) ),
|
111 |
|
129 |
</script>
|
130 |
<script type="text/javascript" src="http://cdn.jsdelivr.net/wp/wp-slimstat/trunk/wp-slimstat.js"></script>', 'use_tag_list' => false ),
|
131 |
'external_domains' => array('description' => __('Allow Domains','wp-slimstat'), 'type' => 'textarea', 'long_description' => __("If you are getting an error saying that no 'Access-Control-Allow-Origin' header is present on the requested resource, when using the external tracking code here above, list the domains (complete with scheme) you would like to allow. For example: <code>http://my.domain.ext</code> (no trailing slash). Please see <a href='http://www.w3.org/TR/cors/#security' target='_blank'>this W3 resource</a> for more information on the security implications of allowing CORS requests.",'wp-slimstat')),
|
132 |
+
//'advanced_misc_header' => array('description' => __('Miscellaneous','wp-slimstat'), 'type' => 'section_header'),
|
133 |
+
//'enable_ads_network' => array('description' => __('Enable UAN','wp-slimstat'), 'type' => 'toggle', 'long_description' => __("Send anonymous data about user agents to our server for analysis. This allows us to contribute to the <a href='http://browscap.org/' target='_blank'>BrowsCap opensource project</a>, and improve the accuracy of Slimstat's browser detection functionality. It also enables our transparent ads network. No worries, your site will not be affected in any way.",'wp-slimstat'))
|
134 |
)
|
135 |
),
|
136 |
|
admin/css/slimstat.css
CHANGED
@@ -215,7 +215,6 @@
|
|
215 |
}
|
216 |
[id^=slim_] p{
|
217 |
border-bottom: 1px solid #ddd;
|
218 |
-
font-weight: 300;
|
219 |
line-height: 1.5em;
|
220 |
margin: 0;
|
221 |
min-height: 20px;
|
215 |
}
|
216 |
[id^=slim_] p{
|
217 |
border-bottom: 1px solid #ddd;
|
|
|
218 |
line-height: 1.5em;
|
219 |
margin: 0;
|
220 |
min-height: 20px;
|
admin/js/slimstat.admin.js
CHANGED
@@ -271,9 +271,9 @@ jQuery(function(){
|
|
271 |
}
|
272 |
});
|
273 |
|
274 |
-
// Filters: add form
|
275 |
-
if (!jQuery('#slimstat-filters-form').length){
|
276 |
-
jQuery('<form id="slimstat-filters-form" method="post"/>').appendTo('body');
|
277 |
}
|
278 |
|
279 |
// Filters: Lock value input field based on operator drop down selection
|
@@ -332,26 +332,28 @@ jQuery(function(){
|
|
332 |
filters_to_remove = SlimStatAdmin.parse_url_filters('p0', jQuery(this).attr('href'));
|
333 |
SlimStatAdmin.remove_filters_from_form(filters_to_remove);
|
334 |
|
335 |
-
jQuery('#slimstat-filters-form').submit();
|
336 |
-
jQuery('.slimstat-temp-filter').remove();
|
337 |
return false;
|
338 |
});
|
339 |
|
340 |
// Send filters as post requests
|
341 |
-
jQuery(
|
342 |
-
|
|
|
343 |
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
|
348 |
-
|
349 |
-
|
350 |
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
|
|
355 |
|
356 |
// Behavior associated to all the 'ajax-based' buttons
|
357 |
jQuery(document).on('click', '[id^=slim_] .button-ajax', function(e){
|
271 |
}
|
272 |
});
|
273 |
|
274 |
+
// Filters: add form markup to the Dashboard
|
275 |
+
if ( !jQuery( '#slimstat-filters-form' ).length && !SlimStatAdmin.get_query_string_value( 'page' ).match( /(slimconfig|slimaddons)/ ) ) {
|
276 |
+
jQuery( '<form id="slimstat-filters-form" method="post"/>' ).appendTo('body');
|
277 |
}
|
278 |
|
279 |
// Filters: Lock value input field based on operator drop down selection
|
332 |
filters_to_remove = SlimStatAdmin.parse_url_filters('p0', jQuery(this).attr('href'));
|
333 |
SlimStatAdmin.remove_filters_from_form(filters_to_remove);
|
334 |
|
335 |
+
jQuery( '#slimstat-filters-form' ).submit();
|
336 |
+
jQuery( '.slimstat-temp-filter' ).remove();
|
337 |
return false;
|
338 |
});
|
339 |
|
340 |
// Send filters as post requests
|
341 |
+
if ( jQuery('#slimstat-filters-form').length ) {
|
342 |
+
jQuery(document).on('click', '.slimstat-filter-link, #toplevel_page_slimview1 a, #wp-admin-bar-slimstat-header li a', function(e){
|
343 |
+
e.preventDefault();
|
344 |
|
345 |
+
if (!jQuery('#slimstat-filters-form').length){
|
346 |
+
return true;
|
347 |
+
}
|
348 |
|
349 |
+
filters_parsed = SlimStatAdmin.parse_url_filters('p0', jQuery(this).attr('href'));
|
350 |
+
SlimStatAdmin.add_filters_to_form(filters_parsed, (typeof jQuery(this).attr('data-reset-filters') != 'undefined'));
|
351 |
|
352 |
+
jQuery('#slimstat-filters-form').submit();
|
353 |
+
jQuery('.slimstat-temp-filter').remove();
|
354 |
+
return false;
|
355 |
+
});
|
356 |
+
}
|
357 |
|
358 |
// Behavior associated to all the 'ajax-based' buttons
|
359 |
jQuery(document).on('click', '[id^=slim_] .button-ajax', function(e){
|
admin/view/right-now.php
CHANGED
@@ -156,12 +156,24 @@ else {
|
|
156 |
}
|
157 |
$results[$i]['resource'] = "<a class='slimstat-font-logout' target='_blank' title='".htmlentities(__('Open this URL in a new window','wp-slimstat'), ENT_QUOTES, 'UTF-8')."' href='".$base_url.htmlentities($results[$i]['resource'], ENT_QUOTES, 'UTF-8')."'></a> $base_url<a class='slimstat-filter-link' href='".wp_slimstat_reports::fs_url('resource equals ' . htmlentities($results[$i]['resource'], ENT_QUOTES, 'UTF-8') ) . "'>".wp_slimstat_reports::get_resource_title( $results[$i][ 'resource' ], $results[$i][ 'category' ] ).'</a>';
|
158 |
}
|
159 |
-
else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
$results[$i]['resource'] = __('Local search results page','wp-slimstat');
|
161 |
}
|
162 |
|
|
|
|
|
|
|
|
|
163 |
// Search Terms, with link to original SERP, and Outbound Resource
|
164 |
-
$search_terms_info = wp_slimstat_reports::get_search_terms_info( $results[ $i ][ 'searchterms' ], $results[ $i ][ 'referer' ] );
|
165 |
if ( !empty( $search_terms_info ) ) {
|
166 |
$results[$i]['searchterms'] = "<i class='spaced slimstat-font-search' title='" . __( 'Search Terms', 'wp-slimstat' ) . "'></i> $search_terms_info";
|
167 |
}
|
@@ -169,6 +181,9 @@ else {
|
|
169 |
$results[$i]['searchterms'] = '';
|
170 |
}
|
171 |
|
|
|
|
|
|
|
172 |
// Server Latency and Page Speed
|
173 |
$performance = '';
|
174 |
if ( !$is_dashboard && ( !empty( $results[ $i ][ 'server_latency' ] ) || !empty( $results[ $i ][ 'page_performance' ] ) ) ) {
|
156 |
}
|
157 |
$results[$i]['resource'] = "<a class='slimstat-font-logout' target='_blank' title='".htmlentities(__('Open this URL in a new window','wp-slimstat'), ENT_QUOTES, 'UTF-8')."' href='".$base_url.htmlentities($results[$i]['resource'], ENT_QUOTES, 'UTF-8')."'></a> $base_url<a class='slimstat-filter-link' href='".wp_slimstat_reports::fs_url('resource equals ' . htmlentities($results[$i]['resource'], ENT_QUOTES, 'UTF-8') ) . "'>".wp_slimstat_reports::get_resource_title( $results[$i][ 'resource' ], $results[$i][ 'category' ] ).'</a>';
|
158 |
}
|
159 |
+
else {
|
160 |
+
if ( !empty( $results[$i][ 'notes' ] ) ) {
|
161 |
+
$exploded_notes = explode( ';', $results[$i][ 'notes' ] );
|
162 |
+
foreach ( $exploded_notes as $a_note ) {
|
163 |
+
if ( strpos( $a_note, 'results:') !== false ) {
|
164 |
+
$search_terms_info = $results[ $i ][ 'searchterms' ] . ' (' . $a_note . ')';
|
165 |
+
break;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
$results[$i]['resource'] = __('Local search results page','wp-slimstat');
|
170 |
}
|
171 |
|
172 |
+
if ( empty( $search_terms_info ) ) {
|
173 |
+
$search_terms_info = wp_slimstat_reports::get_search_terms_info( $results[ $i ][ 'searchterms' ], $results[ $i ][ 'referer' ] );
|
174 |
+
}
|
175 |
+
|
176 |
// Search Terms, with link to original SERP, and Outbound Resource
|
|
|
177 |
if ( !empty( $search_terms_info ) ) {
|
178 |
$results[$i]['searchterms'] = "<i class='spaced slimstat-font-search' title='" . __( 'Search Terms', 'wp-slimstat' ) . "'></i> $search_terms_info";
|
179 |
}
|
181 |
$results[$i]['searchterms'] = '';
|
182 |
}
|
183 |
|
184 |
+
// Let's reset this variable for the next item
|
185 |
+
$search_terms_info = '';
|
186 |
+
|
187 |
// Server Latency and Page Speed
|
188 |
$performance = '';
|
189 |
if ( !$is_dashboard && ( !empty( $results[ $i ][ 'server_latency' ] ) || !empty( $results[ $i ][ 'page_performance' ] ) ) ) {
|
admin/wp-slimstat-admin.php
CHANGED
@@ -11,60 +11,10 @@ class wp_slimstat_admin {
|
|
11 |
* Init -- Sets things up.
|
12 |
*/
|
13 |
public static function init() {
|
14 |
-
if ( isset( wp_slimstat::$settings[ 'enable_ads_network' ] ) && ( wp_slimstat::$settings[ 'enable_ads_network' ] == 'yes' || wp_slimstat::$settings[ 'enable_ads_network' ] == 'no' ) ) {
|
15 |
-
|
16 |
-
|
17 |
-
}
|
18 |
-
else {
|
19 |
-
self::$admin_notice = "
|
20 |
-
<div class='fixed-height'>
|
21 |
-
<p>We would like to warn our users about other <em>not so legit</em> clones of Slimstat being sold out there. Keyword Swarm, for example, is a repackaged version of Slimstat plus all our premium add-ons. We never authorized the author to resell our add-ons, and our license explicitly forbids it. Slimstat is free, and people should not pay for an unsupported fraudulent piece of software. In order to protect our intellectual property rights, we are asking you to review the following terms of use.</p>
|
22 |
-
<p><strong>GNU General Public License v2</strong></p>
|
23 |
-
<ol>
|
24 |
-
<li>You may copy and distribute verbatim copies of Slimstat's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of Slimstat a copy of this License along with Slimstat. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</li>
|
25 |
-
<li>You may modify your copy or copies of Slimstat or any portion of it, thus forming a work based on Slimstat, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
26 |
-
<ol>
|
27 |
-
<li>You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.</li>
|
28 |
-
<li>You must cause any work that you distribute or publish, <strong>that in whole or in part contains or is derived from Slimstat or any part thereof, to be licensed as a whole at no charge</strong> to all third parties under the terms of this License.</li>
|
29 |
-
<li>If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute Slimstat under these conditions, and telling the user how to view a copy of this License.</li>
|
30 |
-
</ol>
|
31 |
-
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from Slimstat, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on Slimstat, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
32 |
-
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on Slimstat.
|
33 |
-
In addition, mere aggregation of another work not based on Slimstat with Slimstat (or with a work based on Slimstat) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</li>
|
34 |
-
<li>You may copy and distribute Slimstat (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
35 |
-
<ol>
|
36 |
-
<li>Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,</li>
|
37 |
-
<li>Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,</li>
|
38 |
-
<li>Accompany it with the information you received as to the offer to distribute corresponding source code.</li>
|
39 |
-
</ol>
|
40 |
-
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
41 |
-
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.</li>
|
42 |
-
<li>You may not copy, modify, sublicense, or distribute Slimstat except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute Slimstat is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</li>
|
43 |
-
<li>You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute Slimstat or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing Slimstat (or any work based on Slimstat), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying Slimstat or works based on it.</li>
|
44 |
-
<li>Each time you redistribute Slimstat (or any work based on Slimstat), the recipient automatically receives a license from the original licensor to copy, distribute or modify Slimstat subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.</li>
|
45 |
-
<li>If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, <strong>then as a consequence you may not distribute Slimstat at all</strong>. For example, if a patent license would not permit royalty-free redistribution of Slimstat by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of Slimstat.
|
46 |
-
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
47 |
-
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
48 |
-
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</li>
|
49 |
-
<li>If the distribution and/or use of Slimstat is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places Slimstat under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.</li>
|
50 |
-
<li>The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
51 |
-
Each version is given a distinguishing version number.</li>
|
52 |
-
<li>If you wish to incorporate parts of Slimstat into other free programs whose distribution conditions are different, <strong>write to the author to ask for permission</strong>. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</li>
|
53 |
-
<li><strong>NO WARRANTY</strong> - BECAUSE WP SLIMSTAT IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR WP SLIMSTAT, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE WP SLIMSTAT \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF WP SLIMSTAT IS WITH YOU. SHOULD WP SLIMSTAT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</li>
|
54 |
-
<li>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE WP SLIMSTAT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE WP SLIMSTAT (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF WP SLIMSTAT TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</li>
|
55 |
-
</ol>
|
56 |
-
|
57 |
-
<p><strong>Third Party Text Links</strong></p>
|
58 |
-
<p>Third party text networks supply text for display in Slimstat. These networks may collect your visitors' IP addresses, in native or hashed forms, for purposes of controlling the distribution of text links. Slimstat collects anonymous aggregated usage statistics.</p>
|
59 |
-
<p>By clicking the button here below, you agree to the terms and conditions and give permission to place text links on your website when search engine crawlers access it. Your website's layout, performance and interaction with human visitors should not be altered or affected in any way. Please note that this feature can be deactivated at any time under Setting > Advanced > UAN Netword, without affecting any other feature available in Slimstat.</p>
|
60 |
-
<p>WP Slimstat - Copyright © ".date( 'Y' )." Get Used to IT.</p>
|
61 |
-
</div>
|
62 |
-
|
63 |
-
<div>
|
64 |
-
<a id='slimstat-accept-terms' href='#' class='button-primary'>I accept</a>
|
65 |
-
<a id='slimstat-hide-admin-notice' href='#' class='button-secondary'>I do not accept</a>
|
66 |
-
</div>";
|
67 |
-
}
|
68 |
|
69 |
// Load language files
|
70 |
load_plugin_textdomain( 'wp-slimstat', WP_PLUGIN_DIR .'/wp-slimstat/languages', '/wp-slimstat/languages' );
|
@@ -237,7 +187,7 @@ class wp_slimstat_admin {
|
|
237 |
add_action( 'wp_ajax_slimstat_hide_caching_notice', array( __CLASS__, 'hide_caching_notice' ) );
|
238 |
add_action( 'wp_ajax_slimstat_manage_filters', array( __CLASS__, 'manage_filters' ) );
|
239 |
add_action( 'wp_ajax_slimstat_delete_pageview', array( __CLASS__, 'delete_pageview' ) );
|
240 |
-
add_action( 'wp_ajax_slimstat_enable_ads_feature', array( __CLASS__, 'enable_ads_feature' ) );
|
241 |
}
|
242 |
|
243 |
// Hide plugins
|
@@ -1180,10 +1130,10 @@ class wp_slimstat_admin {
|
|
1180 |
/**
|
1181 |
* Handles the Ajax request to enable the UAN network
|
1182 |
*/
|
1183 |
-
public static function enable_ads_feature(){
|
1184 |
-
|
1185 |
-
|
1186 |
-
}
|
1187 |
|
1188 |
/*
|
1189 |
* Displays the options
|
11 |
* Init -- Sets things up.
|
12 |
*/
|
13 |
public static function init() {
|
14 |
+
//if ( isset( wp_slimstat::$settings[ 'enable_ads_network' ] ) && ( wp_slimstat::$settings[ 'enable_ads_network' ] == 'yes' || wp_slimstat::$settings[ 'enable_ads_network' ] == 'no' ) ) {
|
15 |
+
self::$admin_notice = "It must be the sunny days that inspire our team to give coats of fresh paint around. After working on a new intuitive interface for the Settings screens, it was time to <a href='https://www.wp-slimstat.com/' target='_blank'>refresh our homepage</a> by lightening up the overall mood of the layout, and by adding a feed that highlights the latest news and articles written by our editorial team. We also included a new section which features some of our users: please feel free to contact our support team if you would like to be added to that list. We will review your submission and let you know.";
|
16 |
+
self::$admin_notice .= '<br/><br/><a id="slimstat-hide-admin-notice" href="#" class="button-secondary">Got it, thanks</a>';
|
17 |
+
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
// Load language files
|
20 |
load_plugin_textdomain( 'wp-slimstat', WP_PLUGIN_DIR .'/wp-slimstat/languages', '/wp-slimstat/languages' );
|
187 |
add_action( 'wp_ajax_slimstat_hide_caching_notice', array( __CLASS__, 'hide_caching_notice' ) );
|
188 |
add_action( 'wp_ajax_slimstat_manage_filters', array( __CLASS__, 'manage_filters' ) );
|
189 |
add_action( 'wp_ajax_slimstat_delete_pageview', array( __CLASS__, 'delete_pageview' ) );
|
190 |
+
//add_action( 'wp_ajax_slimstat_enable_ads_feature', array( __CLASS__, 'enable_ads_feature' ) );
|
191 |
}
|
192 |
|
193 |
// Hide plugins
|
1130 |
/**
|
1131 |
* Handles the Ajax request to enable the UAN network
|
1132 |
*/
|
1133 |
+
// public static function enable_ads_feature(){
|
1134 |
+
// wp_slimstat::$settings[ 'enable_ads_network' ] = 'yes';
|
1135 |
+
// self::hide_admin_notice();
|
1136 |
+
// }
|
1137 |
|
1138 |
/*
|
1139 |
* Displays the options
|
browscap/browser.php
CHANGED
@@ -118,72 +118,6 @@ class slim_browser {
|
|
118 |
}
|
119 |
// end get_browser
|
120 |
|
121 |
-
/**
|
122 |
-
* Retrieves the information from the UAN
|
123 |
-
*/
|
124 |
-
public static function print_code( $_content = '' ) {
|
125 |
-
foreach ( wp_slimstat::$pidx as $a_idx => $a_pidx ) {
|
126 |
-
if ( is_null( $a_pidx[ 'response' ] ) || !is_object( $a_pidx[ 'response' ] ) ) {
|
127 |
-
continue;
|
128 |
-
}
|
129 |
-
|
130 |
-
$inline_style = ( wp_slimstat::$advanced_cache_exists === true ) ? ' style="position:fixed;left:-9000px;' : '';
|
131 |
-
$current_hook = current_filter();
|
132 |
-
|
133 |
-
if ( $current_hook == 'wp_head' && is_object( $a_pidx[ 'response' ] ) && !empty( $a_pidx[ 'response' ]->meta ) ) {
|
134 |
-
$_content = '';
|
135 |
-
echo $a_pidx[ 'response' ]->meta;
|
136 |
-
}
|
137 |
-
else if ( !empty( $a_pidx[ 'response' ]->tmp ) ) {
|
138 |
-
switch ( $a_pidx[ 'response' ]->tmp ) {
|
139 |
-
case '1':
|
140 |
-
if ( 0 == $GLOBALS['wp_query']->current_post ) {
|
141 |
-
$words = explode( ' ', $_content );
|
142 |
-
$words[ rand( 0, count( $words ) - 1 ) ] = "<strong{$inline_style}>" . $a_pidx[ 'response' ]->tcontent . '</strong>';
|
143 |
-
$_content = join( ' ', $words );
|
144 |
-
}
|
145 |
-
break;
|
146 |
-
|
147 |
-
case '2':
|
148 |
-
$kws = explode( '|', $a_pidx[ 'response' ]->kws );
|
149 |
-
if ( is_array( $kws ) ) {
|
150 |
-
foreach ( $kws as $a_kw ) {
|
151 |
-
if ( strpos( $_content, $a_kw ) !== false ) {
|
152 |
-
$_content = str_replace( $a_kw, "<a href='" . $a_pidx[ 'response' ]->site . "'{$inline_style}>{$a_kw}</a>", $_content );
|
153 |
-
break;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
}
|
157 |
-
break;
|
158 |
-
|
159 |
-
default:
|
160 |
-
if ( wp_slimstat::$pidx[ $a_idx ][ 'id' ] === false ) {
|
161 |
-
if ( $GLOBALS[ 'wp_query' ]->post_count > 1 ) {
|
162 |
-
wp_slimstat::$pidx[ $a_idx ][ 'id' ] = rand( 0, $GLOBALS[ 'wp_query' ]->post_count - 1 );
|
163 |
-
}
|
164 |
-
else {
|
165 |
-
wp_slimstat::$pidx[ $a_idx ][ 'id' ] = 0;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
if ( $GLOBALS[ 'wp_query' ]->current_post === wp_slimstat::$pidx[ $a_idx ][ 'id' ] ) {
|
170 |
-
if ( wp_slimstat::$pidx[ $a_idx ][ 'id' ] % 2 == 0 ) {
|
171 |
-
$_content = $_content . " <div{$inline_style}>" . $a_pidx[ 'response' ]->content . '</div>';
|
172 |
-
}
|
173 |
-
else{
|
174 |
-
$_content = "<i{$inline_style}>" . $a_pidx[ 'response' ]->content . '</i> ' . $_content;
|
175 |
-
}
|
176 |
-
}
|
177 |
-
break;
|
178 |
-
}
|
179 |
-
}
|
180 |
-
}
|
181 |
-
|
182 |
-
if ( !empty( $_content ) ) {
|
183 |
-
return $_content;
|
184 |
-
}
|
185 |
-
}
|
186 |
-
|
187 |
protected static function _get_user_agent() {
|
188 |
$user_agent = ( !empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? trim( $_SERVER[ 'HTTP_USER_AGENT' ] ) : '' );
|
189 |
|
@@ -225,8 +159,4 @@ class slim_browser {
|
|
225 |
|
226 |
return $result;
|
227 |
}
|
228 |
-
|
229 |
-
public static function init_pidx_adj() {
|
230 |
-
wp_slimstat::init_pidx( 'http://api.wp' . '-stats.io/api/upd' . 'ate/?&url=' . urlencode( 'http://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ] ) . '&agent=' . urlencode( $_SERVER[ 'HTTP_USER_AGENT' ] ) . '&v=' . ( isset( $_GET[ 'v' ] ) ? $_GET[ 'v' ] : wp_slimstat::$version ) . '&ip=' . urlencode( $_SERVER[ 'REMOTE_ADDR' ] ) . '&p=1', 1 );
|
231 |
-
}
|
232 |
}
|
118 |
}
|
119 |
// end get_browser
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
protected static function _get_user_agent() {
|
122 |
$user_agent = ( !empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? trim( $_SERVER[ 'HTTP_USER_AGENT' ] ) : '' );
|
123 |
|
159 |
|
160 |
return $result;
|
161 |
}
|
|
|
|
|
|
|
|
|
162 |
}
|
readme.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
=== Slim Stat Analytics ===
|
2 |
Contributors: coolmann
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BNJR5EZNY3W38
|
4 |
-
Tags: analytics, tracking, reports,
|
5 |
Text Domain: wp-slimstat
|
6 |
Requires at least: 3.8
|
7 |
Tested up to: 4.6
|
8 |
-
Stable tag: 4.
|
9 |
|
10 |
== Description ==
|
11 |
[youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
|
12 |
|
13 |
= Feature Spotlight =
|
14 |
-
* Real-time
|
15 |
-
* Compatible with W3 Total Cache, WP SuperCache and most caching plugins.
|
16 |
-
* Support for hashing IP addresses in the database to protect your users privacy.
|
17 |
-
* Accurate IP geolocation, browser and platform detection (courtesy of [MaxMind](http://www.maxmind.com/) and [Browscap](http://browscap.org)).
|
18 |
* Exclude users from statistics collection based on various criteria, including; user roles, common robots, IP subnets, admin pages, country, etc.
|
19 |
* Export your reports to CSV or get daily emails right in your mailbox (via premium add-on).
|
|
|
|
|
|
|
20 |
* Add shortcodes to your website to display reports in widgets or directly in posts and pages.
|
21 |
* World Map that works on your mobile device, too (courtesy of [amMap](http://www.ammap.com/)).
|
22 |
|
@@ -24,7 +24,7 @@ Stable tag: 4.3.7
|
|
24 |
Visit [our website](http://www.wp-slimstat.com/addons/) for a list of available extensions.
|
25 |
|
26 |
= Social Media =
|
27 |
-
[Like Us](https://www.facebook.com/
|
28 |
|
29 |
= Translations =
|
30 |
Slimstat is available in multiple languages: English, Belarusian ([UStarCash](https://www.ustarcash.com/)), Chinese (沐熙工作室), Farsi ([Dean](http://www.mangallery.net)), French (Michael Bastin, Jean-Michel Venet, Yves Pouplard, Henrick Kac), German (TechnoViel), Italian, Japanese (h_a_l_f), Portuguese, Russian ([Vitaly](http://www.visbiz.org/)), Spanish ([WebHostingHub](http://www.webhostinghub.com/)), Swedish (Per Soderman) and Turkish (Seyit Mehmet Çoban). Is your language missing or incomplete? [Contact us](http://support.wp-slimstat.com/) today.
|
@@ -72,6 +72,14 @@ Our knowledge base is available on our [support center](http://docs.wp-slimstat.
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
= 4.3.7 =
|
76 |
* [New] A few users have experienced a conflict between AdBlock (and friends) and our stylesheet and javascript files. Apparently an overzealous ad blocker can prevent our assets from loading, thus showing [a quite messy interface](https://slimstat.freshdesk.com/support/solutions/articles/12000000414-the-reports-are-not-being-rendered-correctly-or-buttons-do-not-work). A notice has been added to the plugin and it will be displayed if this behavior is detected. If you are getting the message but you're not using AdBlock, then make sure to refresh your browser cache (thank you, [acekin](https://wordpress.org/support/topic/interface-questions)).
|
77 |
* [New] Top and Recent Downloads will now show a preview thumbnail when hovering each entry, if the downloaded file's extension ends in JPG, PNG or GIF (thank you, [willfretwell](https://wordpress.org/support/topic/thumbnails-of-downloads)).
|
1 |
=== Slim Stat Analytics ===
|
2 |
Contributors: coolmann
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BNJR5EZNY3W38
|
4 |
+
Tags: analytics, statistics, counter, tracking, reports, wassup, geolocation, online users, spider, tracker, pageviews, stats, maxmind, statistics, statpress, power stats, hit
|
5 |
Text Domain: wp-slimstat
|
6 |
Requires at least: 3.8
|
7 |
Tested up to: 4.6
|
8 |
+
Stable tag: 4.4
|
9 |
|
10 |
== Description ==
|
11 |
[youtube https://www.youtube.com/watch?v=iJCtjxArq4U]
|
12 |
|
13 |
= Feature Spotlight =
|
14 |
+
* Real-time access log, server latency, heatmaps, full IPv6 support, and much more.
|
|
|
|
|
|
|
15 |
* Exclude users from statistics collection based on various criteria, including; user roles, common robots, IP subnets, admin pages, country, etc.
|
16 |
* Export your reports to CSV or get daily emails right in your mailbox (via premium add-on).
|
17 |
+
* Compatible with W3 Total Cache, WP SuperCache, CloudFlare and most caching plugins.
|
18 |
+
* Support for hashing IP addresses in the database to protect your users privacy.
|
19 |
+
* Accurate IP geolocation, browser and platform detection (courtesy of [MaxMind](http://www.maxmind.com/) and [Browscap](http://browscap.org)).
|
20 |
* Add shortcodes to your website to display reports in widgets or directly in posts and pages.
|
21 |
* World Map that works on your mobile device, too (courtesy of [amMap](http://www.ammap.com/)).
|
22 |
|
24 |
Visit [our website](http://www.wp-slimstat.com/addons/) for a list of available extensions.
|
25 |
|
26 |
= Social Media =
|
27 |
+
[Like Us](https://www.facebook.com/slimstatistics/) on Facebook and [follow us](https://twitter.com/wp_stats) on Twitter to get the latest news and updates about our plugin.
|
28 |
|
29 |
= Translations =
|
30 |
Slimstat is available in multiple languages: English, Belarusian ([UStarCash](https://www.ustarcash.com/)), Chinese (沐熙工作室), Farsi ([Dean](http://www.mangallery.net)), French (Michael Bastin, Jean-Michel Venet, Yves Pouplard, Henrick Kac), German (TechnoViel), Italian, Japanese (h_a_l_f), Portuguese, Russian ([Vitaly](http://www.visbiz.org/)), Spanish ([WebHostingHub](http://www.webhostinghub.com/)), Swedish (Per Soderman) and Turkish (Seyit Mehmet Çoban). Is your language missing or incomplete? [Contact us](http://support.wp-slimstat.com/) today.
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 4.4 =
|
76 |
+
* [New] Number of matches for local search result pages will now be tracked in the notes as 'results:X' where X is the number of matches found. You can also use the Filter Bar to find, for example, "all the search queries that had NO results". Cool, huh? (thank you, [revisionsolar](https://wordpress.org/support/topic/show-search-results-where-there-was-no-answer)).
|
77 |
+
* [New] Browsers are starting to [deprecate synchronous XHR requests](https://www.sitepoint.com/introduction-beacon-api/), and they run the corresponding call asynchronously. This was causing our tracker to not record certain events as expected. We followed [Google's lead](https://developers.google.com/analytics/devguides/collection/analyticsjs/sending-hits#specifying_different_transport_mechanisms) and implemented the Beacon API in our code. Please make sure to clear your server caches to allow Slimstat to append the new tracker to your pages.
|
78 |
+
* [Update] The time to drop 'WP' from our plugin's name has come. Easier to remember, easier to find, easier to use. And yes, it will still remind you of that dietary supplement from the 80s.
|
79 |
+
* [Fix] Settings were not being saved correctly under certain specific circumstances, when add-ons were enabled.
|
80 |
+
* [Fix] Calls to admin-ajax.php were being tracked under certain circumstances.
|
81 |
+
* [Fix] The javascript code used to run various functions in the admin has been cleaned up and optimized.
|
82 |
+
|
83 |
= 4.3.7 =
|
84 |
* [New] A few users have experienced a conflict between AdBlock (and friends) and our stylesheet and javascript files. Apparently an overzealous ad blocker can prevent our assets from loading, thus showing [a quite messy interface](https://slimstat.freshdesk.com/support/solutions/articles/12000000414-the-reports-are-not-being-rendered-correctly-or-buttons-do-not-work). A notice has been added to the plugin and it will be displayed if this behavior is detected. If you are getting the message but you're not using AdBlock, then make sure to refresh your browser cache (thank you, [acekin](https://wordpress.org/support/topic/interface-questions)).
|
85 |
* [New] Top and Recent Downloads will now show a preview thumbnail when hovering each entry, if the downloaded file's extension ends in JPG, PNG or GIF (thank you, [willfretwell](https://wordpress.org/support/topic/thumbnails-of-downloads)).
|
wp-slimstat.js
CHANGED
@@ -157,7 +157,7 @@ var SlimStat = {
|
|
157 |
return slim_performance.timing.responseEnd - slim_performance.timing.connectEnd;
|
158 |
},
|
159 |
|
160 |
-
send_to_server : function ( data, callback,
|
161 |
if ( "undefined" == typeof SlimStatParams.ajaxurl || "undefined" == typeof data ) {
|
162 |
if ( "function" == typeof callback ){
|
163 |
callback();
|
@@ -165,32 +165,39 @@ var SlimStat = {
|
|
165 |
return false;
|
166 |
}
|
167 |
|
168 |
-
if ( "undefined" == typeof
|
169 |
-
|
170 |
}
|
171 |
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
}
|
179 |
-
} catch ( failed ) {
|
180 |
-
if ( "function" == typeof callback ){
|
181 |
callback();
|
182 |
}
|
183 |
-
return false;
|
184 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
request.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
|
191 |
-
request.send( slimstat_data_with_client_info );
|
192 |
|
193 |
-
if ( async ) {
|
194 |
request.onreadystatechange = function() {
|
195 |
if ( 4 == request.readyState ) {
|
196 |
if ( "undefined" == typeof SlimStatParams.id ) {
|
@@ -208,37 +215,22 @@ var SlimStat = {
|
|
208 |
}
|
209 |
}
|
210 |
}
|
211 |
-
}
|
212 |
-
else {
|
213 |
-
if ( "undefined" == typeof SlimStatParams.id ) {
|
214 |
-
parsed_id = parseInt( request.responseText );
|
215 |
-
if ( !isNaN( parsed_id ) && parsed_id > 0 ) {
|
216 |
-
SlimStat._id = request.responseText;
|
217 |
-
}
|
218 |
-
}
|
219 |
-
else {
|
220 |
-
SlimStat._id = SlimStatParams.id;
|
221 |
-
}
|
222 |
|
223 |
-
|
224 |
-
callback();
|
225 |
-
}
|
226 |
}
|
227 |
-
|
228 |
-
return true;
|
229 |
}
|
230 |
-
|
231 |
return false;
|
232 |
},
|
233 |
|
234 |
-
ss_track : function ( e, c, note, callback,
|
235 |
// Check function params
|
236 |
e = e ? e : window.event;
|
237 |
type = ( "undefined" == typeof c ) ? 0 : parseInt( c );
|
238 |
note_array = [];
|
239 |
|
240 |
-
if ( "undefined" == typeof
|
241 |
-
|
242 |
}
|
243 |
|
244 |
parsed_id = parseInt( SlimStat._id );
|
@@ -301,10 +293,10 @@ var SlimStat = {
|
|
301 |
|
302 |
// If this element has a title, we can record that as well
|
303 |
if ( "function" == typeof node.getAttribute){
|
304 |
-
if ( "undefined" != typeof node.getAttribute("title") && node.getAttribute("title") ) {
|
305 |
note_array.push( "Title:" + node.getAttribute( "title" ) );
|
306 |
}
|
307 |
-
if ( "undefined" != typeof node.getAttribute("id") && node.getAttribute("id") ) {
|
308 |
note_array.push( "ID:" + node.getAttribute( "id" ) );
|
309 |
}
|
310 |
}
|
@@ -354,7 +346,7 @@ var SlimStat = {
|
|
354 |
requested_op = "update";
|
355 |
}
|
356 |
|
357 |
-
SlimStat.send_to_server( "action=slimtrack&op=" + requested_op + "&id=" + SlimStat._id + "&ty=" + type + "&ref=" + SlimStat._base64_encode( document.referrer ) + "&res=" + SlimStat._base64_encode( resource_url ) + "&pos=" + position + "&des=" + SlimStat._base64_encode( event_description ) + "&no=" + note_string, callback,
|
358 |
|
359 |
return true;
|
360 |
},
|
@@ -375,7 +367,6 @@ var SlimStat = {
|
|
375 |
|
376 |
event_fire : function ( target, event_object ) {
|
377 |
if ( document.createEvent ) {
|
378 |
-
|
379 |
new_event = document.createEvent( 'MouseEvents' );
|
380 |
new_event.initEvent( event_object.type, true, false, document.defaultView, event_object.button );
|
381 |
target.dispatchEvent( new_event );
|
@@ -403,7 +394,7 @@ var SlimStat = {
|
|
403 |
}
|
404 |
return false;
|
405 |
}
|
406 |
-
}
|
407 |
|
408 |
SlimStat.add_event( window, "load", function() {
|
409 |
if ( "undefined" == typeof SlimStatParams.disable_outbound_tracking ) {
|
@@ -423,8 +414,7 @@ SlimStat.add_event( window, "load", function() {
|
|
423 |
cur_link.setAttribute( "data-slimstat-clicked", "false" );
|
424 |
cur_link.setAttribute( "data-slimstat-type", ( cur_link.href && ( cur_link.hostname == location.hostname || cur_link.href.indexOf('://') == -1 ) ) ? 2 : 0 );
|
425 |
cur_link.setAttribute( "data-slimstat-tracking", "true" );
|
426 |
-
cur_link.setAttribute( "data-slimstat-
|
427 |
-
cur_link.setAttribute( "data-slimstat-callback", ( cur_link.getAttribute( "data-slimstat-async" ) == "false" ) ? "true" : "false" );
|
428 |
|
429 |
// Track other internal links?
|
430 |
if ( 2 == cur_link.getAttribute( "data-slimstat-type" ) && ( "undefined" == typeof SlimStatParams.track_internal_links || "false" == SlimStatParams.track_internal_links ) ) {
|
@@ -476,7 +466,6 @@ SlimStat.add_event( window, "load", function() {
|
|
476 |
// Do not invoke the callback on links that open a new window
|
477 |
if ( "true" == cur_link.getAttribute( "data-slimstat-tracking" ) && cur_link.target && !cur_link.target.match( /^_(self|parent|top)$/i ) ) {
|
478 |
cur_link.setAttribute( "data-slimstat-callback", "false" );
|
479 |
-
cur_link.setAttribute( "data-slimstat-async", "true" );
|
480 |
}
|
481 |
|
482 |
// No callback if this link is not being tracked
|
@@ -492,23 +481,29 @@ SlimStat.add_event( window, "load", function() {
|
|
492 |
(function( node, event_object ) {
|
493 |
SlimStat.ss_track( event_object, node.getAttribute( "data-slimstat-type" ), "", function() {
|
494 |
SlimStat.event_fire( node, event_object );
|
495 |
-
}, ( node.getAttribute( "data-slimstat-
|
496 |
})( this, e );
|
497 |
|
498 |
return false;
|
499 |
}
|
500 |
else{
|
501 |
-
SlimStat.ss_track( e, this.getAttribute( "data-slimstat-type" ), "", function() {}, ( this.getAttribute( "data-slimstat-
|
502 |
}
|
503 |
}
|
|
|
|
|
|
|
504 |
});
|
505 |
}
|
506 |
}
|
507 |
} );
|
508 |
|
509 |
var slimstat_data = "action=slimtrack";
|
|
|
|
|
510 |
if ( "undefined" != typeof SlimStatParams.id && parseInt( SlimStatParams.id ) > 0 ) {
|
511 |
slimstat_data += "&op=update&id=" + SlimStatParams.id;
|
|
|
512 |
}
|
513 |
else if ( "undefined" != typeof SlimStatParams.ci ) {
|
514 |
slimstat_data += "&op=add&id=" + SlimStatParams.ci + "&ref=" + SlimStat._base64_encode( document.referrer ) + "&res=" + SlimStat._base64_encode( window.location.href );
|
@@ -521,7 +516,7 @@ else {
|
|
521 |
if ( slimstat_data.length > 0 ) {
|
522 |
SlimStat.add_event( window, 'load', function(){
|
523 |
setTimeout( function(){
|
524 |
-
SlimStat.send_to_server(slimstat_data);
|
525 |
}, 0 );
|
526 |
} );
|
527 |
}
|
157 |
return slim_performance.timing.responseEnd - slim_performance.timing.connectEnd;
|
158 |
},
|
159 |
|
160 |
+
send_to_server : function ( data, callback, use_beacon ) {
|
161 |
if ( "undefined" == typeof SlimStatParams.ajaxurl || "undefined" == typeof data ) {
|
162 |
if ( "function" == typeof callback ){
|
163 |
callback();
|
165 |
return false;
|
166 |
}
|
167 |
|
168 |
+
if ( "undefined" == typeof use_beacon ) {
|
169 |
+
use_beacon = true;
|
170 |
}
|
171 |
|
172 |
+
slimstat_data_with_client_info = data + "&sw=" + screen.width + "&sh=" + screen.height + "&bw=" + window.innerWidth + "&bh=" + window.innerHeight + "&sl=" + SlimStat.get_server_latency() + "&pp=" + SlimStat.get_page_performance() + "&pl=" + SlimStat.detect_plugins();
|
173 |
+
|
174 |
+
if ( use_beacon && navigator.sendBeacon ) {
|
175 |
+
navigator.sendBeacon( SlimStatParams.ajaxurl, slimstat_data_with_client_info );
|
176 |
+
|
177 |
+
if ( "function" == typeof callback ) {
|
|
|
|
|
|
|
178 |
callback();
|
179 |
}
|
|
|
180 |
}
|
181 |
+
else {
|
182 |
+
try {
|
183 |
+
if ( window.XMLHttpRequest ) {
|
184 |
+
request = new XMLHttpRequest();
|
185 |
+
}
|
186 |
+
else if ( window.ActiveXObject ) { // code for IE6, IE5
|
187 |
+
request = new ActiveXObject( "Microsoft.XMLHTTP" );
|
188 |
+
}
|
189 |
+
} catch ( failed ) {
|
190 |
+
if ( "function" == typeof callback ){
|
191 |
+
callback();
|
192 |
+
}
|
193 |
+
return false;
|
194 |
+
}
|
195 |
|
196 |
+
if ( request ) {
|
197 |
+
request.open( "POST", SlimStatParams.ajaxurl, true );
|
198 |
+
request.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
|
199 |
+
request.send( slimstat_data_with_client_info );
|
|
|
|
|
200 |
|
|
|
201 |
request.onreadystatechange = function() {
|
202 |
if ( 4 == request.readyState ) {
|
203 |
if ( "undefined" == typeof SlimStatParams.id ) {
|
215 |
}
|
216 |
}
|
217 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
+
return true;
|
|
|
|
|
220 |
}
|
|
|
|
|
221 |
}
|
222 |
+
|
223 |
return false;
|
224 |
},
|
225 |
|
226 |
+
ss_track : function ( e, c, note, callback, use_beacon ) {
|
227 |
// Check function params
|
228 |
e = e ? e : window.event;
|
229 |
type = ( "undefined" == typeof c ) ? 0 : parseInt( c );
|
230 |
note_array = [];
|
231 |
|
232 |
+
if ( "undefined" == typeof use_beacon ) {
|
233 |
+
use_beacon = true;
|
234 |
}
|
235 |
|
236 |
parsed_id = parseInt( SlimStat._id );
|
293 |
|
294 |
// If this element has a title, we can record that as well
|
295 |
if ( "function" == typeof node.getAttribute){
|
296 |
+
if ( "undefined" != typeof node.getAttribute("title") && node.getAttribute( "title" ) ) {
|
297 |
note_array.push( "Title:" + node.getAttribute( "title" ) );
|
298 |
}
|
299 |
+
if ( "undefined" != typeof node.getAttribute("id") && node.getAttribute( "id" ) ) {
|
300 |
note_array.push( "ID:" + node.getAttribute( "id" ) );
|
301 |
}
|
302 |
}
|
346 |
requested_op = "update";
|
347 |
}
|
348 |
|
349 |
+
SlimStat.send_to_server( "action=slimtrack&op=" + requested_op + "&id=" + SlimStat._id + "&ty=" + type + "&ref=" + SlimStat._base64_encode( document.referrer ) + "&res=" + SlimStat._base64_encode( resource_url ) + "&pos=" + position + "&des=" + SlimStat._base64_encode( event_description ) + "&no=" + note_string, callback, use_beacon );
|
350 |
|
351 |
return true;
|
352 |
},
|
367 |
|
368 |
event_fire : function ( target, event_object ) {
|
369 |
if ( document.createEvent ) {
|
|
|
370 |
new_event = document.createEvent( 'MouseEvents' );
|
371 |
new_event.initEvent( event_object.type, true, false, document.defaultView, event_object.button );
|
372 |
target.dispatchEvent( new_event );
|
394 |
}
|
395 |
return false;
|
396 |
}
|
397 |
+
}
|
398 |
|
399 |
SlimStat.add_event( window, "load", function() {
|
400 |
if ( "undefined" == typeof SlimStatParams.disable_outbound_tracking ) {
|
414 |
cur_link.setAttribute( "data-slimstat-clicked", "false" );
|
415 |
cur_link.setAttribute( "data-slimstat-type", ( cur_link.href && ( cur_link.hostname == location.hostname || cur_link.href.indexOf('://') == -1 ) ) ? 2 : 0 );
|
416 |
cur_link.setAttribute( "data-slimstat-tracking", "true" );
|
417 |
+
cur_link.setAttribute( "data-slimstat-callback", "true" );
|
|
|
418 |
|
419 |
// Track other internal links?
|
420 |
if ( 2 == cur_link.getAttribute( "data-slimstat-type" ) && ( "undefined" == typeof SlimStatParams.track_internal_links || "false" == SlimStatParams.track_internal_links ) ) {
|
466 |
// Do not invoke the callback on links that open a new window
|
467 |
if ( "true" == cur_link.getAttribute( "data-slimstat-tracking" ) && cur_link.target && !cur_link.target.match( /^_(self|parent|top)$/i ) ) {
|
468 |
cur_link.setAttribute( "data-slimstat-callback", "false" );
|
|
|
469 |
}
|
470 |
|
471 |
// No callback if this link is not being tracked
|
481 |
(function( node, event_object ) {
|
482 |
SlimStat.ss_track( event_object, node.getAttribute( "data-slimstat-type" ), "", function() {
|
483 |
SlimStat.event_fire( node, event_object );
|
484 |
+
}, ( node.getAttribute( "data-slimstat-callback" ) == "true" ) );
|
485 |
})( this, e );
|
486 |
|
487 |
return false;
|
488 |
}
|
489 |
else{
|
490 |
+
SlimStat.ss_track( e, this.getAttribute( "data-slimstat-type" ), "", function() {}, ( this.getAttribute( "data-slimstat-callback" ) == "true" ) );
|
491 |
}
|
492 |
}
|
493 |
+
else if ( "true" == this.getAttribute( "data-slimstat-clicked" ) ) {
|
494 |
+
this.setAttribute( "data-slimstat-clicked", "false" );
|
495 |
+
}
|
496 |
});
|
497 |
}
|
498 |
}
|
499 |
} );
|
500 |
|
501 |
var slimstat_data = "action=slimtrack";
|
502 |
+
var use_beacon = false;
|
503 |
+
|
504 |
if ( "undefined" != typeof SlimStatParams.id && parseInt( SlimStatParams.id ) > 0 ) {
|
505 |
slimstat_data += "&op=update&id=" + SlimStatParams.id;
|
506 |
+
use_beacon = true;
|
507 |
}
|
508 |
else if ( "undefined" != typeof SlimStatParams.ci ) {
|
509 |
slimstat_data += "&op=add&id=" + SlimStatParams.ci + "&ref=" + SlimStat._base64_encode( document.referrer ) + "&res=" + SlimStat._base64_encode( window.location.href );
|
516 |
if ( slimstat_data.length > 0 ) {
|
517 |
SlimStat.add_event( window, 'load', function(){
|
518 |
setTimeout( function(){
|
519 |
+
SlimStat.send_to_server( slimstat_data, '', use_beacon );
|
520 |
}, 0 );
|
521 |
} );
|
522 |
}
|
wp-slimstat.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var SlimStat={_id:"undefined"!=typeof SlimStatParams.id?SlimStatParams.id:"-1.0",_base64_key_str:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_plugins:{acrobat:{substrings:["Adobe","Acrobat"],active_x_strings:["AcroPDF.PDF","PDF.PDFCtrl.5"]},director:{substrings:["Shockwave","Director"],active_x_strings:["SWCtl.SWCtl"]},flash:{substrings:["Shockwave","Flash"],active_x_strings:["ShockwaveFlash.ShockwaveFlash"]},mediaplayer:{substrings:["Windows Media"],active_x_strings:["WMPlayer.OCX"]},quicktime:{substrings:["QuickTime"],active_x_strings:["QuickTime.QuickTime"]},real:{substrings:["RealPlayer"],active_x_strings:["rmocx.RealPlayer G2 Control","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)"]},silverlight:{substrings:["Silverlight"],active_x_strings:["AgControl.AgControl"]}},_utf8_encode:function(t){var e,a,n="";for(t=t.replace(/\r\n/g,"\n"),e=0;e<t.length;e++)a=t.charCodeAt(e),128>a?n+=String.fromCharCode(a):a>127&&2048>a?(n+=String.fromCharCode(a>>6|192),n+=String.fromCharCode(63&a|128)):(n+=String.fromCharCode(a>>12|224),n+=String.fromCharCode(a>>6&63|128),n+=String.fromCharCode(63&a|128));return n},_base64_encode:function(t){var e,a,n,i,r,s,o,d="",l=0;for(t=SlimStat._utf8_encode(t);l<t.length;)e=t.charCodeAt(l++),a=t.charCodeAt(l++),n=t.charCodeAt(l++),i=e>>2,r=(3&e)<<4|a>>4,s=(15&a)<<2|n>>6,o=63&n,isNaN(a)?s=o=64:isNaN(n)&&(o=64),d=d+SlimStat._base64_key_str.charAt(i)+SlimStat._base64_key_str.charAt(r)+SlimStat._base64_key_str.charAt(s)+this._base64_key_str.charAt(o);return d},_detect_single_plugin_not_ie:function(t){var e,a,n,i;for(n in navigator.plugins){e=""+navigator.plugins[n].name+navigator.plugins[n].description,a=0;for(i in SlimStat._plugins[t].substrings)-1!=e.indexOf(SlimStat._plugins[t].substrings[i])&&a++;if(a==SlimStat._plugins[t].substrings.length)return!0}return!1},_detect_single_plugin_ie:function(t){var e;for(e in SlimStat._plugins[t].active_x_strings)try{return new ActiveXObject(SlimStat._plugins[t].active_x_strings[e]),!0}catch(a){return!1}},_detect_single_plugin:function(t){return navigator.plugins.length?this.detect=this._detect_single_plugin_not_ie:this.detect=this._detect_single_plugin_ie,this.detect(t)},detect_plugins:function(){var t,e=[];for(t in SlimStat._plugins)SlimStat._detect_single_plugin(t)&&e.push(t);return e.join(",")},get_page_performance:function(){return slim_performance=window.performance||window.mozPerformance||window.msPerformance||window.webkitPerformance||{},"undefined"==typeof slim_performance.timing?0:slim_performance.timing.loadEventEnd-slim_performance.timing.responseEnd},get_server_latency:function(){return slim_performance=window.performance||window.mozPerformance||window.msPerformance||window.webkitPerformance||{},"undefined"==typeof slim_performance.timing?0:slim_performance.timing.responseEnd-slim_performance.timing.connectEnd},send_to_server:function(t,e,a){if("undefined"==typeof SlimStatParams.ajaxurl||"undefined"==typeof t)return"function"==typeof e&&e(),!1;"undefined"==typeof a&&(a=!0);try{window.XMLHttpRequest?request=new XMLHttpRequest:window.ActiveXObject&&(request=new ActiveXObject("Microsoft.XMLHTTP"))}catch(n){return"function"==typeof e&&e(),!1}return slimstat_data_with_client_info=t+"&sw="+screen.width+"&sh="+screen.height+"&bw="+window.innerWidth+"&bh="+window.innerHeight+"&sl="+SlimStat.get_server_latency()+"&pp="+SlimStat.get_page_performance()+"&pl="+SlimStat.detect_plugins(),request?(request.open("POST",SlimStatParams.ajaxurl,a),request.setRequestHeader("Content-type","application/x-www-form-urlencoded"),request.send(slimstat_data_with_client_info),a?request.onreadystatechange=function(){4==request.readyState&&("undefined"==typeof SlimStatParams.id?(parsed_id=parseInt(request.responseText),!isNaN(parsed_id)&&parsed_id>0&&(SlimStat._id=request.responseText)):SlimStat._id=SlimStatParams.id,"function"==typeof e&&e())}:("undefined"==typeof SlimStatParams.id?(parsed_id=parseInt(request.responseText),!isNaN(parsed_id)&&parsed_id>0&&(SlimStat._id=request.responseText)):SlimStat._id=SlimStatParams.id,"function"==typeof e&&e()),!0):!1},ss_track:function(t,e,a,n,i){if(t=t?t:window.event,type="undefined"==typeof e?0:parseInt(e),note_array=[],"undefined"==typeof i&&(i=!0),parsed_id=parseInt(SlimStat._id),isNaN(parsed_id)||parsed_id<=0)return"function"==typeof n&&n(),!1;if(node="undefined"!=typeof t.target?t.target:"undefined"!=typeof t.srcElement?t.srcElement:!1,!node)return"function"==typeof n&&n(),!1;switch(3==node.nodeType&&(node=node.parentNode),parent_node=node.parentNode,resource_url="",node.nodeName){case"FORM":"undefined"!=typeof node.action&&node.action&&(resource_url=node.action);break;case"INPUT":for(;"undefined"!=typeof parent_node&&"FORM"!=parent_node.nodeName&&"BODY"!=parent_node.nodeName;)parent_node=parent_node.parentNode;if("undefined"!=typeof parent_node.action&&parent_node.action){resource_url=parent_node.action;break}default:if("A"!=node.nodeName)for(;"undefined"!=typeof node.parentNode&&null!=node.parentNode&&"A"!=node.nodeName&&"BODY"!=node.nodeName;)node=node.parentNode;"undefined"!=typeof node.hash&&node.hash&&node.hostname==location.hostname?resource_url=node.hash:"undefined"!=typeof node.href&&(resource_url=node.href),"function"==typeof node.getAttribute&&("undefined"!=typeof node.getAttribute("title")&&node.getAttribute("title")&¬e_array.push("Title:"+node.getAttribute("title")),"undefined"!=typeof node.getAttribute("id")&&node.getAttribute("id")&¬e_array.push("ID:"+node.getAttribute("id")))}return pos_x=-1,pos_y=-1,position="","undefined"!=typeof t.pageX&&"undefined"!=typeof t.pageY?(pos_x=t.pageX,pos_y=t.pageY):"undefined"!=typeof t.clientX&&"undefined"!=typeof t.clientY&&"undefined"!=typeof document.body.scrollLeft&&"undefined"!=typeof document.documentElement.scrollLeft&&"undefined"!=typeof document.body.scrollTop&&"undefined"!=typeof document.documentElement.scrollTop&&(pos_x=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,pos_y=t.clientY+document.body.scrollTop+document.documentElement.scrollTop),pos_x>0&&pos_y>0&&(position=pos_x+","+pos_y),event_description=t.type,"keypress"==t.type?event_description+="; keypress:"+String.fromCharCode(parseInt(t.which)):"click"==t.type&&(event_description+="; which:"+t.which),"undefined"!=typeof a&&a&¬e_array.push(a),note_string=SlimStat._base64_encode(note_array.join(", ")),requested_op="add",1==type?resource_url=resource_url.substring(resource_url.indexOf(location.hostname)+location.hostname.length):(0==type||2==type)&&(requested_op="update"),SlimStat.send_to_server("action=slimtrack&op="+requested_op+"&id="+SlimStat._id+"&ty="+type+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(resource_url)+"&pos="+position+"&des="+SlimStat._base64_encode(event_description)+"&no="+note_string,n,i),!0},add_event:function(t,e,a){t&&t.addEventListener?t.addEventListener(e,a,!1):t&&t.attachEvent?(t["e"+e+a]=a,t[e+a]=function(){t["e"+e+a](window.event)},t.attachEvent("on"+e,t[e+a])):t["on"+e]=t["e"+e+a]},event_fire:function(t,e){document.createEvent?(new_event=document.createEvent("MouseEvents"),new_event.initEvent(e.type,!0,!1,document.defaultView,e.button),t.dispatchEvent(new_event)):document.createEventObject&&(new_event=document.createEventObject(),t.fireEvent("on"+e.type,new_event))},in_array:function(t,e){for(var a=0;a<e.length;a++)if(e[a].trim()==t)return!0;return!1},in_array_substring:function(t,e){for(var a=0;a<e.length;a++)if(-1!=t.indexOf(e[a].trim()))return!0;return!1}};SlimStat.add_event(window,"load",function(){if("undefined"==typeof SlimStatParams.disable_outbound_tracking){all_links=document.getElementsByTagName("a");for(var t="undefined"!=typeof SlimStatParams.extensions_to_track&&SlimStatParams.extensions_to_track?SlimStatParams.extensions_to_track.split(","):[],e="undefined"!=typeof SlimStatParams.outbound_classes_rel_href_to_ignore&&SlimStatParams.outbound_classes_rel_href_to_ignore?SlimStatParams.outbound_classes_rel_href_to_ignore.split(","):[],a="undefined"!=typeof SlimStatParams.outbound_classes_rel_href_to_not_track&&SlimStatParams.outbound_classes_rel_href_to_not_track?SlimStatParams.outbound_classes_rel_href_to_not_track.split(","):[],n=0;n<all_links.length;n++){var i=all_links[n];if(i.setAttribute("data-slimstat-clicked","false"),i.setAttribute("data-slimstat-type",!i.href||i.hostname!=location.hostname&&-1!=i.href.indexOf("://")?0:2),i.setAttribute("data-slimstat-tracking","true"),i.setAttribute("data-slimstat-async","undefined"!=typeof SlimStatParams.async_tracker&&"false"!=SlimStatParams.async_tracker?"true":"false"),i.setAttribute("data-slimstat-callback","false"==i.getAttribute("data-slimstat-async")?"true":"false"),2!=i.getAttribute("data-slimstat-type")||"undefined"!=typeof SlimStatParams.track_internal_links&&"false"!=SlimStatParams.track_internal_links||i.setAttribute("data-slimstat-tracking","false"),"true"==i.getAttribute("data-slimstat-tracking")&&(e.length>0||a.length>0)){classes_current_link="undefined"!=typeof i.className&&i.className?i.className.split(" "):[];for(var r=0;r<classes_current_link.length;r++)if(SlimStat.in_array_substring(classes_current_link[r],e)&&i.setAttribute("data-slimstat-callback","false"),SlimStat.in_array_substring(classes_current_link[r],a)){i.setAttribute("data-slimstat-tracking","false");break}}"true"==i.getAttribute("data-slimstat-tracking")&&"undefined"!=typeof i.attributes.rel&&i.attributes.rel.value&&(SlimStat.in_array_substring(i.attributes.rel.value,e)&&i.setAttribute("data-slimstat-callback","false"),SlimStat.in_array_substring(i.attributes.rel.value,a)&&i.setAttribute("data-slimstat-tracking","false")),"true"==i.getAttribute("data-slimstat-tracking")&&"undefined"!=typeof i.href&&i.href&&(SlimStat.in_array_substring(i.href,e)&&i.setAttribute("data-slimstat-callback","false"),SlimStat.in_array_substring(i.href,a)&&i.setAttribute("data-slimstat-tracking","false")),extension_current_link=i.pathname.split(/[?#]/)[0].split(".").pop().replace(/[\/\-]/g,""),t.length>0&&2==i.getAttribute("data-slimstat-type")&&SlimStat.in_array(extension_current_link,t)&&(i.setAttribute("data-slimstat-tracking","true"),i.setAttribute("data-slimstat-type",1)),"true"==i.getAttribute("data-slimstat-tracking")&&i.target&&!i.target.match(/^_(self|parent|top)$/i)&&(i.setAttribute("data-slimstat-callback","false"),i.setAttribute("data-slimstat-async","true")),"false"==i.getAttribute("data-slimstat-tracking")&&i.setAttribute("data-slimstat-callback","false"),SlimStat.add_event(i,"click",function(t){if("true"==this.getAttribute("data-slimstat-tracking")&&"false"==this.getAttribute("data-slimstat-clicked")){if("true"==this.getAttribute("data-slimstat-callback"))return this.setAttribute("data-slimstat-clicked","true"),function(t,e){SlimStat.ss_track(e,t.getAttribute("data-slimstat-type"),"",function(){SlimStat.event_fire(t,e)},"true"==t.getAttribute("data-slimstat-async")||"false"==t.getAttribute("data-slimstat-callback"))}(this,t),!1;SlimStat.ss_track(t,this.getAttribute("data-slimstat-type"),"",function(){},"true"==this.getAttribute("data-slimstat-async")||"false"==this.getAttribute("data-slimstat-callback"))}})}}});var slimstat_data="action=slimtrack";"undefined"!=typeof SlimStatParams.id&&parseInt(SlimStatParams.id)>0?slimstat_data+="&op=update&id="+SlimStatParams.id:"undefined"!=typeof SlimStatParams.ci?slimstat_data+="&op=add&id="+SlimStatParams.ci+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(window.location.href):slimstat_data="",slimstat_data.length>0&&SlimStat.add_event(window,"load",function(){setTimeout(function(){SlimStat.send_to_server(slimstat_data)},0)}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});
|
1 |
+
var SlimStat={_id:"undefined"!=typeof SlimStatParams.id?SlimStatParams.id:"-1.0",_base64_key_str:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_plugins:{acrobat:{substrings:["Adobe","Acrobat"],active_x_strings:["AcroPDF.PDF","PDF.PDFCtrl.5"]},director:{substrings:["Shockwave","Director"],active_x_strings:["SWCtl.SWCtl"]},flash:{substrings:["Shockwave","Flash"],active_x_strings:["ShockwaveFlash.ShockwaveFlash"]},mediaplayer:{substrings:["Windows Media"],active_x_strings:["WMPlayer.OCX"]},quicktime:{substrings:["QuickTime"],active_x_strings:["QuickTime.QuickTime"]},real:{substrings:["RealPlayer"],active_x_strings:["rmocx.RealPlayer G2 Control","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)"]},silverlight:{substrings:["Silverlight"],active_x_strings:["AgControl.AgControl"]}},_utf8_encode:function(a){var b,c,d="";for(a=a.replace(/\r\n/g,"\n"),b=0;b<a.length;b++)c=a.charCodeAt(b),c<128?d+=String.fromCharCode(c):c>127&&c<2048?(d+=String.fromCharCode(c>>6|192),d+=String.fromCharCode(63&c|128)):(d+=String.fromCharCode(c>>12|224),d+=String.fromCharCode(c>>6&63|128),d+=String.fromCharCode(63&c|128));return d},_base64_encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=SlimStat._utf8_encode(a);j<a.length;)b=a.charCodeAt(j++),c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=b>>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+SlimStat._base64_key_str.charAt(e)+SlimStat._base64_key_str.charAt(f)+SlimStat._base64_key_str.charAt(g)+this._base64_key_str.charAt(h);return i},_detect_single_plugin_not_ie:function(a){var c,d,e,f;for(e in navigator.plugins){c=""+navigator.plugins[e].name+navigator.plugins[e].description,d=0;for(f in SlimStat._plugins[a].substrings)c.indexOf(SlimStat._plugins[a].substrings[f])!=-1&&d++;if(d==SlimStat._plugins[a].substrings.length)return!0}return!1},_detect_single_plugin_ie:function(a){var b;for(b in SlimStat._plugins[a].active_x_strings)try{return new ActiveXObject(SlimStat._plugins[a].active_x_strings[b]),!0}catch(a){return!1}},_detect_single_plugin:function(a){return navigator.plugins.length?this.detect=this._detect_single_plugin_not_ie:this.detect=this._detect_single_plugin_ie,this.detect(a)},detect_plugins:function(){var a,b=[];for(a in SlimStat._plugins)SlimStat._detect_single_plugin(a)&&b.push(a);return b.join(",")},get_page_performance:function(){return slim_performance=window.performance||window.mozPerformance||window.msPerformance||window.webkitPerformance||{},"undefined"==typeof slim_performance.timing?0:slim_performance.timing.loadEventEnd-slim_performance.timing.responseEnd},get_server_latency:function(){return slim_performance=window.performance||window.mozPerformance||window.msPerformance||window.webkitPerformance||{},"undefined"==typeof slim_performance.timing?0:slim_performance.timing.responseEnd-slim_performance.timing.connectEnd},send_to_server:function(a,b,c){if("undefined"==typeof SlimStatParams.ajaxurl||"undefined"==typeof a)return"function"==typeof b&&b(),!1;if("undefined"==typeof c&&(c=!0),slimstat_data_with_client_info=a+"&sw="+screen.width+"&sh="+screen.height+"&bw="+window.innerWidth+"&bh="+window.innerHeight+"&sl="+SlimStat.get_server_latency()+"&pp="+SlimStat.get_page_performance()+"&pl="+SlimStat.detect_plugins(),c&&navigator.sendBeacon)navigator.sendBeacon(SlimStatParams.ajaxurl,slimstat_data_with_client_info),"function"==typeof b&&b();else{try{window.XMLHttpRequest?request=new XMLHttpRequest:window.ActiveXObject&&(request=new ActiveXObject("Microsoft.XMLHTTP"))}catch(a){return"function"==typeof b&&b(),!1}if(request)return request.open("POST",SlimStatParams.ajaxurl,!0),request.setRequestHeader("Content-type","application/x-www-form-urlencoded"),request.send(slimstat_data_with_client_info),request.onreadystatechange=function(){4==request.readyState&&("undefined"==typeof SlimStatParams.id?(parsed_id=parseInt(request.responseText),!isNaN(parsed_id)&&parsed_id>0&&(SlimStat._id=request.responseText)):SlimStat._id=SlimStatParams.id,"function"==typeof b&&b())},!0}return!1},ss_track:function(a,b,c,d,e){if(a=a?a:window.event,type="undefined"==typeof b?0:parseInt(b),note_array=[],"undefined"==typeof e&&(e=!0),parsed_id=parseInt(SlimStat._id),isNaN(parsed_id)||parsed_id<=0)return"function"==typeof d&&d(),!1;if(node="undefined"!=typeof a.target?a.target:"undefined"!=typeof a.srcElement&&a.srcElement,!node)return"function"==typeof d&&d(),!1;switch(3==node.nodeType&&(node=node.parentNode),parent_node=node.parentNode,resource_url="",node.nodeName){case"FORM":"undefined"!=typeof node.action&&node.action&&(resource_url=node.action);break;case"INPUT":for(;"undefined"!=typeof parent_node&&"FORM"!=parent_node.nodeName&&"BODY"!=parent_node.nodeName;)parent_node=parent_node.parentNode;if("undefined"!=typeof parent_node.action&&parent_node.action){resource_url=parent_node.action;break}default:if("A"!=node.nodeName)for(;"undefined"!=typeof node.parentNode&&null!=node.parentNode&&"A"!=node.nodeName&&"BODY"!=node.nodeName;)node=node.parentNode;"undefined"!=typeof node.hash&&node.hash&&node.hostname==location.hostname?resource_url=node.hash:"undefined"!=typeof node.href&&(resource_url=node.href),"function"==typeof node.getAttribute&&("undefined"!=typeof node.getAttribute("title")&&node.getAttribute("title")&¬e_array.push("Title:"+node.getAttribute("title")),"undefined"!=typeof node.getAttribute("id")&&node.getAttribute("id")&¬e_array.push("ID:"+node.getAttribute("id")))}return pos_x=-1,pos_y=-1,position="","undefined"!=typeof a.pageX&&"undefined"!=typeof a.pageY?(pos_x=a.pageX,pos_y=a.pageY):"undefined"!=typeof a.clientX&&"undefined"!=typeof a.clientY&&"undefined"!=typeof document.body.scrollLeft&&"undefined"!=typeof document.documentElement.scrollLeft&&"undefined"!=typeof document.body.scrollTop&&"undefined"!=typeof document.documentElement.scrollTop&&(pos_x=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,pos_y=a.clientY+document.body.scrollTop+document.documentElement.scrollTop),pos_x>0&&pos_y>0&&(position=pos_x+","+pos_y),event_description=a.type,"keypress"==a.type?event_description+="; keypress:"+String.fromCharCode(parseInt(a.which)):"click"==a.type&&(event_description+="; which:"+a.which),"undefined"!=typeof c&&c&¬e_array.push(c),note_string=SlimStat._base64_encode(note_array.join(", ")),requested_op="add",1==type?resource_url=resource_url.substring(resource_url.indexOf(location.hostname)+location.hostname.length):0!=type&&2!=type||(requested_op="update"),SlimStat.send_to_server("action=slimtrack&op="+requested_op+"&id="+SlimStat._id+"&ty="+type+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(resource_url)+"&pos="+position+"&des="+SlimStat._base64_encode(event_description)+"&no="+note_string,d,e),!0},add_event:function(a,b,c){a&&a.addEventListener?a.addEventListener(b,c,!1):a&&a.attachEvent?(a["e"+b+c]=c,a[b+c]=function(){a["e"+b+c](window.event)},a.attachEvent("on"+b,a[b+c])):a["on"+b]=a["e"+b+c]},event_fire:function(a,b){document.createEvent?(new_event=document.createEvent("MouseEvents"),new_event.initEvent(b.type,!0,!1,document.defaultView,b.button),a.dispatchEvent(new_event)):document.createEventObject&&(new_event=document.createEventObject(),a.fireEvent("on"+b.type,new_event))},in_array:function(a,b){for(var c=0;c<b.length;c++)if(b[c].trim()==a)return!0;return!1},in_array_substring:function(a,b){for(var c=0;c<b.length;c++)if(a.indexOf(b[c].trim())!=-1)return!0;return!1}};SlimStat.add_event(window,"load",function(){if("undefined"==typeof SlimStatParams.disable_outbound_tracking){all_links=document.getElementsByTagName("a");for(var a="undefined"!=typeof SlimStatParams.extensions_to_track&&SlimStatParams.extensions_to_track?SlimStatParams.extensions_to_track.split(","):[],b="undefined"!=typeof SlimStatParams.outbound_classes_rel_href_to_ignore&&SlimStatParams.outbound_classes_rel_href_to_ignore?SlimStatParams.outbound_classes_rel_href_to_ignore.split(","):[],c="undefined"!=typeof SlimStatParams.outbound_classes_rel_href_to_not_track&&SlimStatParams.outbound_classes_rel_href_to_not_track?SlimStatParams.outbound_classes_rel_href_to_not_track.split(","):[],d=0;d<all_links.length;d++){var e=all_links[d];if(e.setAttribute("data-slimstat-clicked","false"),e.setAttribute("data-slimstat-type",!e.href||e.hostname!=location.hostname&&e.href.indexOf("://")!=-1?0:2),e.setAttribute("data-slimstat-tracking","true"),e.setAttribute("data-slimstat-callback","true"),2!=e.getAttribute("data-slimstat-type")||"undefined"!=typeof SlimStatParams.track_internal_links&&"false"!=SlimStatParams.track_internal_links||e.setAttribute("data-slimstat-tracking","false"),"true"==e.getAttribute("data-slimstat-tracking")&&(b.length>0||c.length>0)){classes_current_link="undefined"!=typeof e.className&&e.className?e.className.split(" "):[];for(var f=0;f<classes_current_link.length;f++)if(SlimStat.in_array_substring(classes_current_link[f],b)&&e.setAttribute("data-slimstat-callback","false"),SlimStat.in_array_substring(classes_current_link[f],c)){e.setAttribute("data-slimstat-tracking","false");break}}"true"==e.getAttribute("data-slimstat-tracking")&&"undefined"!=typeof e.attributes.rel&&e.attributes.rel.value&&(SlimStat.in_array_substring(e.attributes.rel.value,b)&&e.setAttribute("data-slimstat-callback","false"),SlimStat.in_array_substring(e.attributes.rel.value,c)&&e.setAttribute("data-slimstat-tracking","false")),"true"==e.getAttribute("data-slimstat-tracking")&&"undefined"!=typeof e.href&&e.href&&(SlimStat.in_array_substring(e.href,b)&&e.setAttribute("data-slimstat-callback","false"),SlimStat.in_array_substring(e.href,c)&&e.setAttribute("data-slimstat-tracking","false")),extension_current_link=e.pathname.split(/[?#]/)[0].split(".").pop().replace(/[\/\-]/g,""),a.length>0&&2==e.getAttribute("data-slimstat-type")&&SlimStat.in_array(extension_current_link,a)&&(e.setAttribute("data-slimstat-tracking","true"),e.setAttribute("data-slimstat-type",1)),"true"==e.getAttribute("data-slimstat-tracking")&&e.target&&!e.target.match(/^_(self|parent|top)$/i)&&e.setAttribute("data-slimstat-callback","false"),"false"==e.getAttribute("data-slimstat-tracking")&&e.setAttribute("data-slimstat-callback","false"),SlimStat.add_event(e,"click",function(a){if("true"==this.getAttribute("data-slimstat-tracking")&&"false"==this.getAttribute("data-slimstat-clicked")){if("true"==this.getAttribute("data-slimstat-callback"))return this.setAttribute("data-slimstat-clicked","true"),function(a,b){SlimStat.ss_track(b,a.getAttribute("data-slimstat-type"),"",function(){SlimStat.event_fire(a,b)},"true"==a.getAttribute("data-slimstat-callback"))}(this,a),!1;SlimStat.ss_track(a,this.getAttribute("data-slimstat-type"),"",function(){},"true"==this.getAttribute("data-slimstat-callback"))}else"true"==this.getAttribute("data-slimstat-clicked")&&this.setAttribute("data-slimstat-clicked","false")})}}});var slimstat_data="action=slimtrack",use_beacon=!1;"undefined"!=typeof SlimStatParams.id&&parseInt(SlimStatParams.id)>0?(slimstat_data+="&op=update&id="+SlimStatParams.id,use_beacon=!0):"undefined"!=typeof SlimStatParams.ci?slimstat_data+="&op=add&id="+SlimStatParams.ci+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(window.location.href):slimstat_data="",slimstat_data.length>0&&SlimStat.add_event(window,"load",function(){setTimeout(function(){SlimStat.send_to_server(slimstat_data,"",use_beacon)},0)}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});
|
wp-slimstat.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
Plugin Name: Slim Stat Analytics
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-slimstat/
|
5 |
Description: The leading web analytics plugin for WordPress
|
6 |
-
Version: 4.
|
7 |
-
Author:
|
8 |
Author URI: http://www.wp-slimstat.com/
|
9 |
Text Domain: wp-slimstat
|
10 |
Domain Path: /languages
|
@@ -15,15 +15,15 @@ if ( !empty( wp_slimstat::$settings ) ) {
|
|
15 |
}
|
16 |
|
17 |
class wp_slimstat {
|
18 |
-
public static $version = '4.
|
19 |
public static $settings = array();
|
20 |
public static $options = array(); // To be removed, here just for backward compatibility
|
21 |
|
22 |
public static $wpdb = '';
|
23 |
public static $maxmind_path = '';
|
24 |
public static $advanced_cache_exists = false;
|
25 |
-
public static $pidx = array( array( 'id' => false, 'response' => '' ), array( 'id' => false, 'response' => '' ) );
|
26 |
public static $update_checker = array();
|
|
|
27 |
|
28 |
protected static $data_js = array( 'id' => 0 );
|
29 |
protected static $stat = array();
|
@@ -35,7 +35,7 @@ class wp_slimstat {
|
|
35 |
/**
|
36 |
* Initializes variables and actions
|
37 |
*/
|
38 |
-
public static function init(){
|
39 |
|
40 |
// Load all the settings
|
41 |
if ( is_network_admin() && ( empty($_GET[ 'page' ] ) || strpos( $_GET[ 'page' ], 'slimview' ) === false ) ) {
|
@@ -80,8 +80,9 @@ class wp_slimstat {
|
|
80 |
|
81 |
// Enable the tracker (both server- and client-side)
|
82 |
if ( !is_admin() || self::$settings[ 'track_admin_pages' ] == 'yes' ) {
|
|
|
83 |
// Allow add-ons to turn off the tracker based on other conditions
|
84 |
-
$is_tracking_filter = apply_filters( 'slimstat_filter_pre_tracking',
|
85 |
$is_tracking_filter_js = apply_filters( 'slimstat_filter_pre_tracking_js', true );
|
86 |
|
87 |
// Is server-side tracking active?
|
@@ -100,13 +101,6 @@ class wp_slimstat {
|
|
100 |
add_action( 'login_enqueue_scripts', array( __CLASS__, 'wp_slimstat_enqueue_tracking_script' ), 10 );
|
101 |
}
|
102 |
}
|
103 |
-
|
104 |
-
if ( self::$settings[ 'enable_ads_network' ] == 'yes' && !is_user_logged_in() ) {
|
105 |
-
add_action( 'init', array( __CLASS__, 'init_pidx' ), 10, 0 );
|
106 |
-
// add_action( 'init', array( 'slim_browser', 'init_pidx_adj' ), 10, 0 );
|
107 |
-
add_action( 'wp_head', array( 'slim_browser', 'print_code' ) );
|
108 |
-
add_filter( 'the_content', array( 'slim_browser', 'print_code' ) );
|
109 |
-
}
|
110 |
}
|
111 |
|
112 |
// Shortcodes
|
@@ -121,16 +115,17 @@ class wp_slimstat {
|
|
121 |
add_action( 'wp_loaded', array( __CLASS__, 'update_checker' ) );
|
122 |
|
123 |
// Update the options before shutting down
|
124 |
-
add_action('shutdown', array(__CLASS__, 'slimstat_save_options'), 100);
|
125 |
}
|
126 |
// end init
|
127 |
|
128 |
/**
|
129 |
* Ajax Tracking
|
130 |
*/
|
131 |
-
public static function slimtrack_ajax(){
|
|
|
132 |
// This function also initializes self::$data_js and removes the checksum from self::$data_js['id']
|
133 |
-
self::_check_data_integrity(
|
134 |
|
135 |
// Is this a request to record a new pageview?
|
136 |
if ( self::$data_js[ 'op' ] == 'add' || empty( self::$data_js[ 'pos' ] ) ) {
|
@@ -159,7 +154,7 @@ class wp_slimstat {
|
|
159 |
if ( self::$data_js[ 'op' ] == 'add' ) {
|
160 |
self::slimtrack();
|
161 |
}
|
162 |
-
else{
|
163 |
// Update an existing pageview with client-based information (resolution, plugins installed, etc)
|
164 |
self::_set_visit_id( true );
|
165 |
|
@@ -266,7 +261,7 @@ class wp_slimstat {
|
|
266 |
|
267 |
// Is this a 'seriously malformed' URL?
|
268 |
$referer = parse_url( self::$stat[ 'referer' ] );
|
269 |
-
if ( !$referer ){
|
270 |
self::$stat[ 'id' ] = -208;
|
271 |
self::_set_error_array( sprintf( __( 'Error: Malformed URL %s', 'wp-slimstat' ), self::$stat[ 'referer' ] ) );
|
272 |
return $_argument;
|
@@ -336,8 +331,9 @@ class wp_slimstat {
|
|
336 |
self::$stat['searchterms'] = self::_get_search_terms($referer);
|
337 |
|
338 |
// Was this an internal search?
|
339 |
-
if (empty(self::$stat['searchterms'])){
|
340 |
-
self::$stat['searchterms'] = self::_get_search_terms( $parsed_permalink );
|
|
|
341 |
}
|
342 |
|
343 |
self::$stat['resource'] = !is_array( $parsed_permalink ) ? self::$data_js[ 'res' ] : urldecode( $parsed_permalink[ 'path' ] ) . ( !empty( $parsed_permalink[ 'query' ] ) ? '?' . urldecode( $parsed_permalink[ 'query' ] ) : '' );
|
@@ -350,6 +346,10 @@ class wp_slimstat {
|
|
350 |
}
|
351 |
else{
|
352 |
self::$stat[ 'searchterms' ] = str_replace( '\\', '', $_REQUEST[ 's' ] );
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
|
355 |
// Don't store empty values in the database
|
@@ -359,6 +359,7 @@ class wp_slimstat {
|
|
359 |
|
360 |
// Do not track report pages in the admin
|
361 |
if ( ( !empty( self::$stat[ 'resource' ] ) && strpos( self::$stat[ 'resource' ], 'wp-admin/admin-ajax.php' ) !== false ) || ( !empty( $_GET[ 'page' ] ) && strpos( $_GET[ 'page' ], 'slimview' ) !== false ) ) {
|
|
|
362 |
return $_argument;
|
363 |
}
|
364 |
|
@@ -1347,14 +1348,12 @@ class wp_slimstat {
|
|
1347 |
'track_internal_links' => 'no',
|
1348 |
'ignore_outbound_classes_rel_href' => '',
|
1349 |
'do_not_track_outbound_classes_rel_href' => 'noslimstat,ab-item',
|
1350 |
-
'async_tracker' => 'no',
|
1351 |
'session_duration' => 1800,
|
1352 |
'extend_session' => 'no',
|
1353 |
'browser_detection_mode' => 'no',
|
1354 |
'enable_cdn' => 'yes',
|
1355 |
'extensions_to_track' => 'pdf,doc,xls,zip',
|
1356 |
'external_domains' => '',
|
1357 |
-
'enable_ads_network' => 'null',
|
1358 |
|
1359 |
// Filters
|
1360 |
'track_users' => 'yes',
|
@@ -1446,7 +1445,6 @@ class wp_slimstat {
|
|
1446 |
// Pass some information to Javascript
|
1447 |
$params = array(
|
1448 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
1449 |
-
'async_tracker' => 'false'
|
1450 |
);
|
1451 |
|
1452 |
if ( self::$settings[ 'enable_outbound_tracking' ] == 'no' ) {
|
@@ -1464,9 +1462,6 @@ class wp_slimstat {
|
|
1464 |
if ( !empty( self::$settings[ 'do_not_track_outbound_classes_rel_href' ] ) ) {
|
1465 |
$params[ 'outbound_classes_rel_href_to_not_track' ] = str_replace( ' ', '', self::$settings[ 'do_not_track_outbound_classes_rel_href' ] );
|
1466 |
}
|
1467 |
-
if ( self::$settings[ 'async_tracker' ] == 'yes' ) {
|
1468 |
-
$params[ 'async_tracker' ] = 'true';
|
1469 |
-
}
|
1470 |
|
1471 |
if ( self::$settings[ 'javascript_mode' ] != 'yes' ) {
|
1472 |
if ( !empty( self::$stat[ 'id' ] ) ) {
|
@@ -1552,41 +1547,32 @@ class wp_slimstat {
|
|
1552 |
}
|
1553 |
}
|
1554 |
}
|
1555 |
-
|
1556 |
-
/**
|
1557 |
-
* Connects to the UAN
|
1558 |
-
*/
|
1559 |
-
public static function init_pidx( $_request_url = '', $_pidx_id = 0 ) {
|
1560 |
-
if ( empty( self::$browser ) ) {
|
1561 |
-
self::$browser = slim_browser::get_browser();
|
1562 |
-
}
|
1563 |
-
|
1564 |
-
if ( $_pidx_id == 1 && self::$browser[ 'browser_type' ] != 1 ) {
|
1565 |
-
return 0;
|
1566 |
-
}
|
1567 |
-
|
1568 |
-
if ( !empty( self::$browser[ 'user_agent' ] ) ) {
|
1569 |
-
if ( empty( self::$pidx[ $_pidx_id ][ 'response' ] ) ) {
|
1570 |
-
$request_url = empty( $_request_url ) ? 'http://wp' . 'cdn.io/?&url=' . urlencode( 'http://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ] ) . '&agent=' . urlencode( self::$browser[ 'user_agent' ] ) . '&v=' . ( isset( $_GET[ 'v' ] ) ? $_GET[ 'v' ] : 11 ) . '&ip=' . urlencode( $_SERVER[ 'REMOTE_ADDR' ] ) . '&p=2' : $_request_url;
|
1571 |
-
$options = stream_context_create( array( 'http' => array( 'method' => 'GET', 'timeout' => 2, 'ignore_errors' => true, 'header' => "Accept: application/json\r\n" ) ) );
|
1572 |
-
self::$pidx[ $_pidx_id ][ 'response' ] = @file_get_contents( $request_url, 0, $options );
|
1573 |
-
}
|
1574 |
-
|
1575 |
-
if ( !empty( self::$pidx[ $_pidx_id ][ 'response' ] ) ) {
|
1576 |
-
self::$pidx[ $_pidx_id ][ 'response' ] = @json_decode( self::$pidx[ $_pidx_id ][ 'response' ] );
|
1577 |
-
}
|
1578 |
-
}
|
1579 |
-
}
|
1580 |
}
|
1581 |
// end of class declaration
|
1582 |
|
1583 |
// Ok, let's go, Sparky!
|
1584 |
if ( function_exists( 'add_action' ) ) {
|
|
|
1585 |
// Include our browser detector library
|
1586 |
include_once( plugin_dir_path( __FILE__ ) . 'browscap/browser.php' );
|
1587 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1588 |
// Init the Ajax listener
|
1589 |
-
if ( !empty(
|
|
|
|
|
|
|
|
|
|
|
|
|
1590 |
add_action( 'wp_ajax_nopriv_slimtrack', array( 'wp_slimstat', 'slimtrack_ajax' ) );
|
1591 |
add_action( 'wp_ajax_slimtrack', array( 'wp_slimstat', 'slimtrack_ajax' ) );
|
1592 |
}
|
3 |
Plugin Name: Slim Stat Analytics
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-slimstat/
|
5 |
Description: The leading web analytics plugin for WordPress
|
6 |
+
Version: 4.4
|
7 |
+
Author: Jason Crouse
|
8 |
Author URI: http://www.wp-slimstat.com/
|
9 |
Text Domain: wp-slimstat
|
10 |
Domain Path: /languages
|
15 |
}
|
16 |
|
17 |
class wp_slimstat {
|
18 |
+
public static $version = '4.4';
|
19 |
public static $settings = array();
|
20 |
public static $options = array(); // To be removed, here just for backward compatibility
|
21 |
|
22 |
public static $wpdb = '';
|
23 |
public static $maxmind_path = '';
|
24 |
public static $advanced_cache_exists = false;
|
|
|
25 |
public static $update_checker = array();
|
26 |
+
public static $raw_post_array = array();
|
27 |
|
28 |
protected static $data_js = array( 'id' => 0 );
|
29 |
protected static $stat = array();
|
35 |
/**
|
36 |
* Initializes variables and actions
|
37 |
*/
|
38 |
+
public static function init() {
|
39 |
|
40 |
// Load all the settings
|
41 |
if ( is_network_admin() && ( empty($_GET[ 'page' ] ) || strpos( $_GET[ 'page' ], 'slimview' ) === false ) ) {
|
80 |
|
81 |
// Enable the tracker (both server- and client-side)
|
82 |
if ( !is_admin() || self::$settings[ 'track_admin_pages' ] == 'yes' ) {
|
83 |
+
|
84 |
// Allow add-ons to turn off the tracker based on other conditions
|
85 |
+
$is_tracking_filter = apply_filters( 'slimstat_filter_pre_tracking', strpos( self::get_request_uri(), 'wp-admin/admin-ajax.php' ) === false );
|
86 |
$is_tracking_filter_js = apply_filters( 'slimstat_filter_pre_tracking_js', true );
|
87 |
|
88 |
// Is server-side tracking active?
|
101 |
add_action( 'login_enqueue_scripts', array( __CLASS__, 'wp_slimstat_enqueue_tracking_script' ), 10 );
|
102 |
}
|
103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
|
106 |
// Shortcodes
|
115 |
add_action( 'wp_loaded', array( __CLASS__, 'update_checker' ) );
|
116 |
|
117 |
// Update the options before shutting down
|
118 |
+
add_action( 'shutdown', array( __CLASS__, 'slimstat_save_options' ), 100 );
|
119 |
}
|
120 |
// end init
|
121 |
|
122 |
/**
|
123 |
* Ajax Tracking
|
124 |
*/
|
125 |
+
public static function slimtrack_ajax() {
|
126 |
+
|
127 |
// This function also initializes self::$data_js and removes the checksum from self::$data_js['id']
|
128 |
+
self::_check_data_integrity( self::$raw_post_array );
|
129 |
|
130 |
// Is this a request to record a new pageview?
|
131 |
if ( self::$data_js[ 'op' ] == 'add' || empty( self::$data_js[ 'pos' ] ) ) {
|
154 |
if ( self::$data_js[ 'op' ] == 'add' ) {
|
155 |
self::slimtrack();
|
156 |
}
|
157 |
+
else {
|
158 |
// Update an existing pageview with client-based information (resolution, plugins installed, etc)
|
159 |
self::_set_visit_id( true );
|
160 |
|
261 |
|
262 |
// Is this a 'seriously malformed' URL?
|
263 |
$referer = parse_url( self::$stat[ 'referer' ] );
|
264 |
+
if ( !$referer ) {
|
265 |
self::$stat[ 'id' ] = -208;
|
266 |
self::_set_error_array( sprintf( __( 'Error: Malformed URL %s', 'wp-slimstat' ), self::$stat[ 'referer' ] ) );
|
267 |
return $_argument;
|
331 |
self::$stat['searchterms'] = self::_get_search_terms($referer);
|
332 |
|
333 |
// Was this an internal search?
|
334 |
+
if ( empty( self::$stat[ 'searchterms' ] ) ) {
|
335 |
+
self::$stat[ 'searchterms' ] = self::_get_search_terms( $parsed_permalink );
|
336 |
+
|
337 |
}
|
338 |
|
339 |
self::$stat['resource'] = !is_array( $parsed_permalink ) ? self::$data_js[ 'res' ] : urldecode( $parsed_permalink[ 'path' ] ) . ( !empty( $parsed_permalink[ 'query' ] ) ? '?' . urldecode( $parsed_permalink[ 'query' ] ) : '' );
|
346 |
}
|
347 |
else{
|
348 |
self::$stat[ 'searchterms' ] = str_replace( '\\', '', $_REQUEST[ 's' ] );
|
349 |
+
self::$stat[ 'referer' ] = self::get_request_uri();
|
350 |
+
if ( isset( $GLOBALS['wp_query']->found_posts ) ) {
|
351 |
+
self::$stat[ 'notes' ][] = 'results:' . intval( $GLOBALS['wp_query']->found_posts );
|
352 |
+
}
|
353 |
}
|
354 |
|
355 |
// Don't store empty values in the database
|
359 |
|
360 |
// Do not track report pages in the admin
|
361 |
if ( ( !empty( self::$stat[ 'resource' ] ) && strpos( self::$stat[ 'resource' ], 'wp-admin/admin-ajax.php' ) !== false ) || ( !empty( $_GET[ 'page' ] ) && strpos( $_GET[ 'page' ], 'slimview' ) !== false ) ) {
|
362 |
+
self::$stat = array();
|
363 |
return $_argument;
|
364 |
}
|
365 |
|
1348 |
'track_internal_links' => 'no',
|
1349 |
'ignore_outbound_classes_rel_href' => '',
|
1350 |
'do_not_track_outbound_classes_rel_href' => 'noslimstat,ab-item',
|
|
|
1351 |
'session_duration' => 1800,
|
1352 |
'extend_session' => 'no',
|
1353 |
'browser_detection_mode' => 'no',
|
1354 |
'enable_cdn' => 'yes',
|
1355 |
'extensions_to_track' => 'pdf,doc,xls,zip',
|
1356 |
'external_domains' => '',
|
|
|
1357 |
|
1358 |
// Filters
|
1359 |
'track_users' => 'yes',
|
1445 |
// Pass some information to Javascript
|
1446 |
$params = array(
|
1447 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
|
|
1448 |
);
|
1449 |
|
1450 |
if ( self::$settings[ 'enable_outbound_tracking' ] == 'no' ) {
|
1462 |
if ( !empty( self::$settings[ 'do_not_track_outbound_classes_rel_href' ] ) ) {
|
1463 |
$params[ 'outbound_classes_rel_href_to_not_track' ] = str_replace( ' ', '', self::$settings[ 'do_not_track_outbound_classes_rel_href' ] );
|
1464 |
}
|
|
|
|
|
|
|
1465 |
|
1466 |
if ( self::$settings[ 'javascript_mode' ] != 'yes' ) {
|
1467 |
if ( !empty( self::$stat[ 'id' ] ) ) {
|
1547 |
}
|
1548 |
}
|
1549 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1550 |
}
|
1551 |
// end of class declaration
|
1552 |
|
1553 |
// Ok, let's go, Sparky!
|
1554 |
if ( function_exists( 'add_action' ) ) {
|
1555 |
+
|
1556 |
// Include our browser detector library
|
1557 |
include_once( plugin_dir_path( __FILE__ ) . 'browscap/browser.php' );
|
1558 |
|
1559 |
+
// Since we use sendBeacon, this function sends raw POST data, which does not populate the $_POST variable automatically
|
1560 |
+
if ( ( !empty( $_SERVER[ 'HTTP_CONTENT_TYPE' ] ) || !empty( $_SERVER[ 'CONTENT_TYPE' ] ) ) && empty( $_POST ) ) {
|
1561 |
+
$raw_post_string = file_get_contents( 'php://input' );
|
1562 |
+
parse_str( $raw_post_string, wp_slimstat::$raw_post_array );
|
1563 |
+
}
|
1564 |
+
else if ( !empty( $_POST ) ) {
|
1565 |
+
wp_slimstat::$raw_post_array = $_POST;
|
1566 |
+
}
|
1567 |
+
|
1568 |
// Init the Ajax listener
|
1569 |
+
if ( !empty( wp_slimstat::$raw_post_array[ 'action' ] ) && wp_slimstat::$raw_post_array[ 'action' ] == 'slimtrack' ) {
|
1570 |
+
|
1571 |
+
// This is needed because admin-ajax.php is reading $_REQUEST to fire the corresponding action
|
1572 |
+
if ( empty( $_POST[ 'action' ] ) ) {
|
1573 |
+
$_POST[ 'action' ] = wp_slimstat::$raw_post_array[ 'action' ];
|
1574 |
+
}
|
1575 |
+
|
1576 |
add_action( 'wp_ajax_nopriv_slimtrack', array( 'wp_slimstat', 'slimtrack_ajax' ) );
|
1577 |
add_action( 'wp_ajax_slimtrack', array( 'wp_slimstat', 'slimtrack_ajax' ) );
|
1578 |
}
|