Slimstat Analytics - Version 4.8.7.1

Version Description

  • [Note] We are in the process of deprecating the two columns type and event_description in the events table, and consolidating that information in the notes field. Code will be added to Slimstat in a few released to actually drop these columns from the database. If you are using those two columns in your custom code, please feel free to contact our support team to discuss your options and how to update your code using the information collected by the new tracker.
  • [Fix] A warning message was being displayed when enabling the opt-out feature with certain versions of PHP.
  • [Fix] PHP warning being displayed when trying to update some of the add-ons' settings.
  • [Fix] The new tracker was recording the number of posts on an archive page even when the single article was being displayed.
  • [Fix] License keys for premium add-ons were not being saved as expected, due to a side effect of the new security features we implemented in the Settings.
Download this release

Release Info

Developer coolmann
Plugin Icon 128x128 Slimstat Analytics
Version 4.8.7.1
Comparing to
See all releases

Code changes from version 4.8.7 to 4.8.7.1

CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
  ## Changelog ##
 
 
 
 
 
 
 
2
  ### 4.8.7 ###
3
  * [New] With this update, we are introducing an *updated tracker* (both server and client-side): a new simplified codebase that gets rid of a few layers of convoluted functions and algorithms accumulated over the years. We have been working on this update for quite a while, and the recent conflict with another plugin discovered by some users convinced us to make this our top priority. Even though we have tested our new code using a variety of scenarios, you can understand how it would be impossible to cover all the possible environments available out there. Make sure to clear your caches (local, Cloudflare, WP plugins, etc), to allow Slimstat to append the new tracking script to your pages. Also, if you are using Slimstat to track *external* pages (outside of your WP install), please make sure to update the code you're using on those pages with the new one you can find in Slimstat > Settings > Tracker > External Pages.
4
  * [New] Increased minimum WordPress requirements to version 4.9, given that we are now using some more modern functions to enqueue the tracker and implement the customizer feature.
1
  ## Changelog ##
2
+ ### 4.8.7.1 ###
3
+ * [Note] We are in the process of deprecating the two columns *type* and *event_description* in the events table, and consolidating that information in the *notes* field. Code will be added to Slimstat in a few released to actually drop these columns from the database. If you are using those two columns in your custom code, please feel free to contact our support team to discuss your options and how to update your code using the information collected by the new tracker.
4
+ * [Fix] A warning message was being displayed when enabling the opt-out feature with certain versions of PHP.
5
+ * [Fix] PHP warning being displayed when trying to update some of the add-ons' settings.
6
+ * [Fix] The new tracker was recording the number of posts on an archive page even when the single article was being displayed.
7
+ * [Fix] License keys for premium add-ons were not being saved as expected, due to a side effect of the new security features we implemented in the Settings.
8
+
9
  ### 4.8.7 ###
10
  * [New] With this update, we are introducing an *updated tracker* (both server and client-side): a new simplified codebase that gets rid of a few layers of convoluted functions and algorithms accumulated over the years. We have been working on this update for quite a while, and the recent conflict with another plugin discovered by some users convinced us to make this our top priority. Even though we have tested our new code using a variety of scenarios, you can understand how it would be impossible to cover all the possible environments available out there. Make sure to clear your caches (local, Cloudflare, WP plugins, etc), to allow Slimstat to append the new tracking script to your pages. Also, if you are using Slimstat to track *external* pages (outside of your WP install), please make sure to update the code you're using on those pages with the new one you can find in Slimstat > Settings > Tracker > External Pages.
11
  * [New] Increased minimum WordPress requirements to version 4.9, given that we are now using some more modern functions to enqueue the tracker and implement the customizer feature.
admin/config/index.php CHANGED
@@ -806,7 +806,7 @@ foreach ( $settings as $a_tab_id => $a_tab_info ) {
806
  name="options[' . $a_setting_slug . ']"
807
  id="' . $a_setting_slug . '"
808
  data-size="mini" data-handle-width="50" data-on-color="success"' .
809
- ( ( wp_slimstat::$settings[ $a_setting_slug ] == 'on' ) ? ' checked="checked"' : '' ) . '
810
  data-on-text="' . ( !empty( $a_setting_info[ 'custom_label_on' ] ) ? $a_setting_info[ 'custom_label_on' ] : __( 'On', 'wp-slimstat' ) ) . '"
811
  data-off-text="' . ( !empty( $a_setting_info[ 'custom_label_off' ] ) ? $a_setting_info[ 'custom_label_off' ] : __( 'Off', 'wp-slimstat' ) ) . '">' .
812
  $network_override_checkbox . '
@@ -822,7 +822,7 @@ foreach ( $settings as $a_tab_id => $a_tab_info ) {
822
  <span class="block-element">
823
  <select' . $is_readonly .' name="options[' . $a_setting_slug . ']" id="' . $a_setting_slug .'">';
824
  foreach ( $a_setting_info[ 'select_values' ] as $a_key => $a_value ) {
825
- $is_selected = ( wp_slimstat::$settings[ $a_setting_slug ] == $a_key ) ? ' selected' : '';
826
  echo '<option' . $is_selected . ' value="' . $a_key . '">' . $a_value . '</option>';
827
  }
828
  echo '</select>' .
806
  name="options[' . $a_setting_slug . ']"
807
  id="' . $a_setting_slug . '"
808
  data-size="mini" data-handle-width="50" data-on-color="success"' .
809
+ ( ( !empty( wp_slimstat::$settings[ $a_setting_slug ] ) && wp_slimstat::$settings[ $a_setting_slug ] == 'on' ) ? ' checked="checked"' : '' ) . '
810
  data-on-text="' . ( !empty( $a_setting_info[ 'custom_label_on' ] ) ? $a_setting_info[ 'custom_label_on' ] : __( 'On', 'wp-slimstat' ) ) . '"
811
  data-off-text="' . ( !empty( $a_setting_info[ 'custom_label_off' ] ) ? $a_setting_info[ 'custom_label_off' ] : __( 'Off', 'wp-slimstat' ) ) . '">' .
812
  $network_override_checkbox . '
822
  <span class="block-element">
823
  <select' . $is_readonly .' name="options[' . $a_setting_slug . ']" id="' . $a_setting_slug .'">';
824
  foreach ( $a_setting_info[ 'select_values' ] as $a_key => $a_value ) {
825
+ $is_selected = ( !empty( wp_slimstat::$settings[ $a_setting_slug ] ) && wp_slimstat::$settings[ $a_setting_slug ] == $a_key ) ? ' selected' : '';
826
  echo '<option' . $is_selected . ' value="' . $a_key . '">' . $a_value . '</option>';
827
  }
828
  echo '</select>' .
admin/index.php CHANGED
@@ -18,7 +18,7 @@ class wp_slimstat_admin {
18
  * Init -- Sets things up.
19
  */
20
  public static function init() {
21
- self::$admin_notice = "With this update, we are introducing a <strong>brand-new tracker</strong> (both server and client-side): a new simplified codebase that gets rid of a few layers of convoluted functions and algorithms accumulated over the years. We have been working on this update for quite a while, and the recent conflict with another plugin discovered by some users convinced us to make this our top priority. Even though we have tested our new code using a variety of scenarios, you can understand how it would be impossible to cover all the possible environments available out there. Make sure to clear your caches (local, Cloudflare, WP plugins, etc), to allow Slimstat to append the new tracking script to your pages. Also, if you are using Slimstat to track <strong>external</strong> pages (outside of your WP install), please make sure to update the code you're using on those pages with the new one you can find in Slimstat > Settings > Tracker > External Pages. As always, do not hesitate to contact <a href='https://support.wp-slimstat.com/' target='_blank'>our support team</a> if you notice any issues.";
22
  // self::$admin_notice = "In this day and age where every single social media platform knows our individual whereabouts on the Interwebs, we have been doing some research on what <em>the techies</em> out there call <a href='https://amiunique.org/fp' target='_blank'>browser fingerprinting</a>. With this technique, it is not necessary to install any cookies to identify a specific user. This means that the act of fingerprinting a specific browser is stateless and transparent, and thus much more accurate. We are already wearing our lab coats and are hard at work to leverage <a href='https://github.com/Valve/fingerprintjs2' target='_blank'>tools like Fingerprint2</a> in Slimstat. This library, among other things, will allow our tracker to record your users' timezone: wouldn't it be nice to know what time it was for the user who was visiting your website? Of course, if you have Privacy Mode enabled, this feature will not be used, in compliance with GDPR and other international privacy laws. Stay tuned!";
23
 
24
  // Load language files
18
  * Init -- Sets things up.
19
  */
20
  public static function init() {
21
+ self::$admin_notice = "We are deprecating the two columns <em>type</em> and <em>event_description</em> in the events table, and consolidating that information in the <em>notes</em> field. Code will be added to Slimstat in a few released to actually drop these columns from the database. If you are using those two columns in your custom code, please feel free to contact our support team to discuss your options and how to update your code using the information collected by the new tracker.";
22
  // self::$admin_notice = "In this day and age where every single social media platform knows our individual whereabouts on the Interwebs, we have been doing some research on what <em>the techies</em> out there call <a href='https://amiunique.org/fp' target='_blank'>browser fingerprinting</a>. With this technique, it is not necessary to install any cookies to identify a specific user. This means that the act of fingerprinting a specific browser is stateless and transparent, and thus much more accurate. We are already wearing our lab coats and are hard at work to leverage <a href='https://github.com/Valve/fingerprintjs2' target='_blank'>tools like Fingerprint2</a> in Slimstat. This library, among other things, will allow our tracker to record your users' timezone: wouldn't it be nice to know what time it was for the user who was visiting your website? Of course, if you have Privacy Mode enabled, this feature will not be used, in compliance with GDPR and other international privacy laws. Stay tuned!";
23
 
24
  // Load language files
admin/view/addons.php CHANGED
@@ -5,8 +5,17 @@ if ( !function_exists( 'add_action' ) ) {
5
  }
6
 
7
  // Update license keys, if needed
8
- if ( !empty( $_POST[ 'licenses' ] ) ) {
9
- wp_slimstat::$settings[ 'addon_licenses' ] = $_POST[ 'licenses' ];
 
 
 
 
 
 
 
 
 
10
  }
11
 
12
  $response = get_transient( 'wp_slimstat_addon_list' );
@@ -48,6 +57,7 @@ if ( !is_array( $list_addons ) ) {
48
  </p>
49
 
50
  <form method="post" id="form-slimstat-options-tab-addons">
 
51
  <table class="wp-list-table widefat plugins slimstat-addons" cellspacing="0">
52
  <thead>
53
  <tr>
5
  }
6
 
7
  // Update license keys, if needed
8
+ if ( !empty( $_POST[ 'licenses' ] ) && is_array( $_POST[ 'licenses' ] ) && !empty( $_POST[ 'slimstat_update_licenses' ] ) && wp_verify_nonce( $_POST[ 'slimstat_update_licenses' ], 'slimstat_update_licenses' ) ) {
9
+ foreach( $_POST[ 'licenses' ] as $a_license_slug => $a_license_key ) {
10
+ wp_slimstat::$settings[ 'addon_licenses' ][ $a_license_slug ] = sanitize_title( $a_license_key );
11
+ }
12
+
13
+ if ( !is_network_admin() ) {
14
+ update_option( 'slimstat_options', wp_slimstat::$settings );
15
+ }
16
+ else {
17
+ update_site_option( 'slimstat_options', wp_slimstat::$settings );
18
+ }
19
  }
20
 
21
  $response = get_transient( 'wp_slimstat_addon_list' );
57
  </p>
58
 
59
  <form method="post" id="form-slimstat-options-tab-addons">
60
+ <?php wp_nonce_field( 'slimstat_update_licenses', 'slimstat_update_licenses' ); ?>
61
  <table class="wp-list-table widefat plugins slimstat-addons" cellspacing="0">
62
  <thead>
63
  <tr>
readme.txt CHANGED
@@ -6,7 +6,7 @@ Text Domain: wp-slimstat
6
  Requires at least: 4.9
7
  Requires PHP: 5.2
8
  Tested up to: 5.2
9
- Stable tag: 4.8.7
10
 
11
  == Description ==
12
  The leading web analytics plugin for WordPress. Track returning customers and registered users, monitor Javascript events, detect intrusions, analyze email campaigns. Thousands of WordPress sites are already using it.
@@ -60,6 +60,13 @@ Our knowledge base is available on our [support center](https://docs.wp-slimstat
60
  5. **Responsive layout** - Keep an eye on your reports on the go
61
 
62
  == Changelog ==
 
 
 
 
 
 
 
63
  = 4.8.7 =
64
  * [New] With this update, we are introducing an *updated tracker* (both server and client-side): a new simplified codebase that gets rid of a few layers of convoluted functions and algorithms accumulated over the years. We have been working on this update for quite a while, and the recent conflict with another plugin discovered by some users convinced us to make this our top priority. Even though we have tested our new code using a variety of scenarios, you can understand how it would be impossible to cover all the possible environments available out there. Make sure to clear your caches (local, Cloudflare, WP plugins, etc), to allow Slimstat to append the new tracking script to your pages. Also, if you are using Slimstat to track *external* pages (outside of your WP install), please make sure to update the code you're using on those pages with the new one you can find in Slimstat > Settings > Tracker > External Pages.
65
  * [New] Increased minimum WordPress requirements to version 4.9, given that we are now using some more modern functions to enqueue the tracker and implement the customizer feature.
@@ -71,6 +78,11 @@ Our knowledge base is available on our [support center](https://docs.wp-slimstat
71
  * [Fix] A bug was affecting certain shortcodes when PHP 7.2 was enabled (thank you, Peter).
72
  * [Fix] Emptying one of the settings and saving did not produce the desired effect.
73
 
 
 
 
 
 
74
  = 4.8.6.1 =
75
  * [Fix] A regression bug was introduced in 4.8.6, affecting some of the shortcodes and reports.
76
 
6
  Requires at least: 4.9
7
  Requires PHP: 5.2
8
  Tested up to: 5.2
9
+ Stable tag: 4.8.7.1
10
 
11
  == Description ==
12
  The leading web analytics plugin for WordPress. Track returning customers and registered users, monitor Javascript events, detect intrusions, analyze email campaigns. Thousands of WordPress sites are already using it.
60
  5. **Responsive layout** - Keep an eye on your reports on the go
61
 
62
  == Changelog ==
63
+ = 4.8.7.1 =
64
+ * [Note] We are in the process of deprecating the two columns *type* and *event_description* in the events table, and consolidating that information in the *notes* field. Code will be added to Slimstat in a few released to actually drop these columns from the database. If you are using those two columns in your custom code, please feel free to contact our support team to discuss your options and how to update your code using the information collected by the new tracker.
65
+ * [Fix] A warning message was being displayed when enabling the opt-out feature with certain versions of PHP.
66
+ * [Fix] PHP warning being displayed when trying to update some of the add-ons' settings.
67
+ * [Fix] The new tracker was recording the number of posts on an archive page even when the single article was being displayed.
68
+ * [Fix] License keys for premium add-ons were not being saved as expected, due to a side effect of the new security features we implemented in the Settings.
69
+
70
  = 4.8.7 =
71
  * [New] With this update, we are introducing an *updated tracker* (both server and client-side): a new simplified codebase that gets rid of a few layers of convoluted functions and algorithms accumulated over the years. We have been working on this update for quite a while, and the recent conflict with another plugin discovered by some users convinced us to make this our top priority. Even though we have tested our new code using a variety of scenarios, you can understand how it would be impossible to cover all the possible environments available out there. Make sure to clear your caches (local, Cloudflare, WP plugins, etc), to allow Slimstat to append the new tracking script to your pages. Also, if you are using Slimstat to track *external* pages (outside of your WP install), please make sure to update the code you're using on those pages with the new one you can find in Slimstat > Settings > Tracker > External Pages.
72
  * [New] Increased minimum WordPress requirements to version 4.9, given that we are now using some more modern functions to enqueue the tracker and implement the customizer feature.
78
  * [Fix] A bug was affecting certain shortcodes when PHP 7.2 was enabled (thank you, Peter).
79
  * [Fix] Emptying one of the settings and saving did not produce the desired effect.
80
 
81
+ =======
82
+ = 4.8.6.2 =
83
+ * [Update] We tweaked the SQL query to retrieve 'recent' results, and added a GROUP BY clause to remove duplicates. This might affect some custom reports you might have created, so please don't hesitate to contact us if you have any question or experience any issues.
84
+ * [Fix] The button to delete all the records from the database was not working as expected (thank you, [Softfully](https://wordpress.org/support/topic/delete-all-records-doesnt-work/)).
85
+
86
  = 4.8.6.1 =
87
  * [Fix] A regression bug was introduced in 4.8.6, affecting some of the shortcodes and reports.
88
 
wp-slimstat.js CHANGED
@@ -91,7 +91,7 @@ var SlimStat = {
91
 
92
  // Retrieves and displays the opt-out message dynamically, to avoid issues with cached pages
93
  show_optout_message : function() {
94
- opt_out_cookies = ( "undefined" != typeof SlimStatParams.oc && SlimStatParams.oc ) ? SlimStatParams.oc.split( ',' ) : [];
95
  if ( !Array.isArray( opt_out_cookies ) ) {
96
  opt_out_cookies = [];
97
  }
@@ -169,6 +169,9 @@ var SlimStat = {
169
  else if ( "string" == typeof variable || "object" == typeof variable ) {
170
  return variable.length == 0;
171
  }
 
 
 
172
  },
173
 
174
  // Retrieves the value associated to a given cookie
91
 
92
  // Retrieves and displays the opt-out message dynamically, to avoid issues with cached pages
93
  show_optout_message : function() {
94
+ opt_out_cookies = !SlimStat.empty( SlimStatParams.oc ) ? SlimStatParams.oc.split( ',' ) : [];
95
  if ( !Array.isArray( opt_out_cookies ) ) {
96
  opt_out_cookies = [];
97
  }
169
  else if ( "string" == typeof variable || "object" == typeof variable ) {
170
  return variable.length == 0;
171
  }
172
+ else {
173
+ return true;
174
+ }
175
  },
176
 
177
  // Retrieves the value associated to a given cookie
wp-slimstat.min.js CHANGED
@@ -1 +1 @@
1
- var SlimStat={_base64_key_str:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-",_utf8_encode:function(t){var e,a,r="";for(t=t.replace(/\r\n/g,"\n"),e=0;e<t.length;e++)(a=t.charCodeAt(e))<128?r+=String.fromCharCode(a):a>127&&a<2048?(r+=String.fromCharCode(a>>6|192),r+=String.fromCharCode(63&a|128)):(r+=String.fromCharCode(a>>12|224),r+=String.fromCharCode(a>>6&63|128),r+=String.fromCharCode(63&a|128));return r},_base64_encode:function(t){var e,a,r,n,o,i,s,m="",d=0;for(t=SlimStat._utf8_encode(t);d<t.length;)n=(e=t.charCodeAt(d++))>>2,o=(3&e)<<4|(a=t.charCodeAt(d++))>>4,i=(15&a)<<2|(r=t.charCodeAt(d++))>>6,s=63&r,isNaN(a)?i=s=64:isNaN(r)&&(s=64),m=m+SlimStat._base64_key_str.charAt(n)+SlimStat._base64_key_str.charAt(o)+SlimStat._base64_key_str.charAt(i)+SlimStat._base64_key_str.charAt(s);return m},get_page_performance:function(){return slim_performance=window.performance||window.mozPerformance||window.msPerformance||window.webkitPerformance||{},void 0===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||{},void 0===slim_performance.timing?0:slim_performance.timing.responseEnd-slim_performance.timing.connectEnd},optout:function(t,e){t.preventDefault(),"string"==typeof SlimStatParams.baseurl&&0!=SlimStatParams.baseurl.length||(SlimStatParams.baseurl="/"),expiration=new Date,expiration.setTime(expiration.getTime()+31536e6),document.cookie="slimstat_optout_tracking="+e+";path="+SlimStatParams.baseurl+";expires="+expiration.toGMTString(),t.target.parentNode.parentNode.removeChild(t.target.parentNode)},show_optout_message:function(){opt_out_cookies=void 0!==SlimStatParams.oc&&SlimStatParams.oc?SlimStatParams.oc.split(","):[],Array.isArray(opt_out_cookies)||(opt_out_cookies=[]),show_optout=opt_out_cookies.length>0;for(var t=0;t<opt_out_cookies.length;t++)""!=SlimStat.get_cookie(opt_out_cookies[t])&&(show_optout=!1);if(show_optout){try{xhr=new XMLHttpRequest}catch(t){return!1}if("object"==typeof xhr)return xhr.open("POST",SlimStatParams.ajaxurl,!0),xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.withCredentials=!0,xhr.send("action=slimstat_optout_html"),xhr.onreadystatechange=function(){4==xhr.readyState&&document.body.insertAdjacentHTML("beforeend",xhr.responseText)},!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]},in_array:function(t,e){for(var a=0;a<e.length;a++)if(-1!=t.indexOf(e[a].trim()))return!0;return!1},empty:function(t){return void 0===t||null==t||("number"==typeof t?0==t:"boolean"==typeof t?!t:"string"==typeof t||"object"==typeof t?0==t.length:void 0)},get_cookie:function(t){var e=("; "+document.cookie).split("; "+t+"=");return 2==e.length?e.pop().split(";").shift():""},send_to_server:function(t,e){if(SlimStat.empty(SlimStatParams.ajaxurl)||SlimStat.empty(t))return!1;if(void 0===e&&(e=!0),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(),e&&navigator.sendBeacon)navigator.sendBeacon(SlimStatParams.ajaxurl,slimstat_data_with_client_info);else{try{xhr=new XMLHttpRequest}catch(t){return!1}if("object"==typeof xhr)return xhr.open("POST",SlimStatParams.ajaxurl,!0),xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.withCredentials=!0,xhr.send(slimstat_data_with_client_info),xhr.onreadystatechange=function(){4==xhr.readyState&&(parsed_id=parseInt(xhr.responseText),!isNaN(parsed_id)&&parsed_id>0&&(SlimStatParams.id=xhr.responseText))},!0}return!1},ss_track:function(t,e){if(SlimStat.empty(SlimStatParams.id)||isNaN(parseInt(SlimStatParams.id))||parseInt(SlimStatParams.id)<=0)return!1;if(note_array=[],SlimStat.empty(t)||note_array.push(t),void 0===e&&(e=!0),SlimStat.empty(window.event))return!1;if(SlimStat.empty(window.event.target)){if(SlimStat.empty(window.event.srcElement))return!1;target_node=window.event.srcElement}else target_node=window.event.target;if(resource_url="",do_not_track=SlimStat.empty(SlimStatParams.dnt)?[]:SlimStatParams.dnt.split(","),!SlimStat.empty(do_not_track.length)&&(target_classes=SlimStat.empty(target_node.className)?[]:target_node.className.split(" "),0!=target_classes.filter(t=>-1!==do_not_track.indexOf(t)).length||!SlimStat.empty(target_node.attributes)&&!SlimStat.empty(target_node.attributes.rel)&&!SlimStat.empty(target_node.attributes.rel.value)&&SlimStat.in_array(target_node.attributes.rel.value,do_not_track)))return!1;if(!SlimStat.empty(target_node.nodeName))switch(target_node.nodeName){case"FORM":SlimStat.empty(target_node.action)||(resource_url=target_node.action);break;case"INPUT":for(parent_node=target_node.parentNode;"undefined"!=typeof parent_node&&"FORM"!=parent_node.nodeName&&"BODY"!=parent_node.nodeName;)parent_node=parent_node.parentNode;SlimStat.empty(parent_node.action)||(resource_url=parent_node.action);break;default:for(parent_node=target_node;"undefined"!=typeof parent_node&&"A"!=parent_node.nodeName&&"BODY"!=parent_node.nodeName;)parent_node=parent_node.parentNode;if("A"==parent_node.nodeName)if(target_node=parent_node,SlimStat.empty(target_node.hash)||target_node.hostname!=location.hostname){if(!SlimStat.empty(target_node.href)&&-1==target_node.href.indexOf("javascript:")){if(SlimStat.in_array(target_node.href,do_not_track))return!1;resource_url=target_node.href}}else resource_url=target_node.hash;"function"==typeof target_node.getAttribute&&(SlimStat.empty(target_node.getAttribute("title"))||note_array.push("Title:"+target_node.getAttribute("title")),SlimStat.empty(target_node.getAttribute("id"))||note_array.push("ID:"+target_node.getAttribute("id")))}return position="0,0",SlimStat.empty(window.event.pageX)||SlimStat.empty(window.event.pageY)?SlimStat.empty(window.event.clientX)||SlimStat.empty(document.body.scrollLeft)||SlimStat.empty(document.documentElement.scrollLeft)||(position=window.event.clientX+document.body.scrollLeft+document.documentElement.scrollLeft+","+window.event.clientY+document.body.scrollTop+document.documentElement.scrollTop):position=window.event.pageX+","+window.event.pageY,SlimStat.empty(window.event.type)||(note_array.push("type:"+window.event.type),"keypress"==window.event.type?note_array.push("keypress:"+String.fromCharCode(parseInt(window.event.which))):"click"==window.event.type&&note_array.push("which:"+window.event.which)),SlimStat.send_to_server("action=slimtrack&id="+SlimStatParams.id+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(resource_url)+"&pos="+position+"&no="+SlimStat._base64_encode(note_array.join(", ")),e),!0}};"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),SlimStat.add_event(window,"load",function(){slimstat_data="",use_beacon=!0,SlimStat.empty(SlimStatParams.id)?(slimstat_data="action=slimtrack&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(window.location.href),SlimStat.empty(SlimStatParams.ci)||(slimstat_data+="&ci="+SlimStatParams.ci),use_beacon=!1):parseInt(SlimStatParams.id)>0&&(slimstat_data="action=slimtrack&id="+SlimStatParams.id),slimstat_data.length>0&&setTimeout(function(){SlimStat.send_to_server(slimstat_data,use_beacon)},50),all_links=document.getElementsByTagName("a");for(var t=0;t<all_links.length;t++)SlimStat.add_event(all_links[t],"click",function(t){SlimStat.ss_track()});SlimStat.show_optout_message()});
1
+ var SlimStat={_base64_key_str:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-",_utf8_encode:function(a){var b,d,e="";for(a=a.replace(/\r\n/g,"\n"),b=0;b<a.length;b++)d=a.charCodeAt(b),128>d?e+=String.fromCharCode(d):127<d&&2048>d?(e+=String.fromCharCode(192|d>>6),e+=String.fromCharCode(128|63&d)):(e+=String.fromCharCode(224|d>>12),e+=String.fromCharCode(128|63&d>>6),e+=String.fromCharCode(128|63&d));return e},_base64_encode:function(a){var b,c,d,e,f,g,h,j="",k=0;for(a=SlimStat._utf8_encode(a);k<a.length;)b=a.charCodeAt(k++),c=a.charCodeAt(k++),d=a.charCodeAt(k++),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),j=j+SlimStat._base64_key_str.charAt(e)+SlimStat._base64_key_str.charAt(f)+SlimStat._base64_key_str.charAt(g)+SlimStat._base64_key_str.charAt(h);return j},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},optout:function(a,b){a.preventDefault(),("string"!=typeof SlimStatParams.baseurl||0==SlimStatParams.baseurl.length)&&(SlimStatParams.baseurl="/"),expiration=new Date,expiration.setTime(expiration.getTime()+31536e6),document.cookie="slimstat_optout_tracking="+b+";path="+SlimStatParams.baseurl+";expires="+expiration.toGMTString(),a.target.parentNode.parentNode.removeChild(a.target.parentNode)},show_optout_message:function(){opt_out_cookies=SlimStat.empty(SlimStatParams.oc)?[]:SlimStatParams.oc.split(","),Array.isArray(opt_out_cookies)||(opt_out_cookies=[]),show_optout=0<opt_out_cookies.length;for(var a=0;a<opt_out_cookies.length;a++)""!=SlimStat.get_cookie(opt_out_cookies[a])&&(show_optout=!1);if(show_optout){try{xhr=new XMLHttpRequest}catch(a){return!1}if("object"==typeof xhr)return xhr.open("POST",SlimStatParams.ajaxurl,!0),xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.withCredentials=!0,xhr.send("action=slimstat_optout_html"),xhr.onreadystatechange=function(){4==xhr.readyState&&document.body.insertAdjacentHTML("beforeend",xhr.responseText)},!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]},in_array:function(a,b){for(var c=0;c<b.length;c++)if(-1!=a.indexOf(b[c].trim()))return!0;return!1},empty:function(a){return!("undefined"!=typeof a&&null!=a)||("number"==typeof a?0==a:"boolean"==typeof a?!a:"string"!=typeof a&&"object"!=typeof a||0==a.length)},get_cookie:function(a){var b="; "+document.cookie,c=b.split("; "+a+"=");return 2==c.length?c.pop().split(";").shift():""},send_to_server:function(a,b){if(SlimStat.empty(SlimStatParams.ajaxurl)||SlimStat.empty(a))return!1;if("undefined"==typeof b&&(b=!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(),b&&navigator.sendBeacon)navigator.sendBeacon(SlimStatParams.ajaxurl,slimstat_data_with_client_info);else{try{xhr=new XMLHttpRequest}catch(a){return!1}if("object"==typeof xhr)return xhr.open("POST",SlimStatParams.ajaxurl,!0),xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.withCredentials=!0,xhr.send(slimstat_data_with_client_info),xhr.onreadystatechange=function(){4==xhr.readyState&&(parsed_id=parseInt(xhr.responseText),!isNaN(parsed_id)&&0<parsed_id&&(SlimStatParams.id=xhr.responseText))},!0}return!1},ss_track:function(a,b){if(SlimStat.empty(SlimStatParams.id)||isNaN(parseInt(SlimStatParams.id))||0>=parseInt(SlimStatParams.id))return!1;if(note_array=[],SlimStat.empty(a)||note_array.push(a),"undefined"==typeof b&&(b=!0),SlimStat.empty(window.event))return!1;if(!SlimStat.empty(window.event.target))target_node=window.event.target;else if(!SlimStat.empty(window.event.srcElement))target_node=window.event.srcElement;else return!1;if(resource_url="",do_not_track=SlimStat.empty(SlimStatParams.dnt)?[]:SlimStatParams.dnt.split(","),!SlimStat.empty(do_not_track.length)&&(target_classes=SlimStat.empty(target_node.className)?[]:target_node.className.split(" "),0!=target_classes.filter(a=>-1!==do_not_track.indexOf(a)).length||!SlimStat.empty(target_node.attributes)&&!SlimStat.empty(target_node.attributes.rel)&&!SlimStat.empty(target_node.attributes.rel.value)&&SlimStat.in_array(target_node.attributes.rel.value,do_not_track)))return!1;if(!SlimStat.empty(target_node.nodeName))switch(target_node.nodeName){case"FORM":SlimStat.empty(target_node.action)||(resource_url=target_node.action);break;case"INPUT":for(parent_node=target_node.parentNode;"undefined"!=typeof parent_node&&"FORM"!=parent_node.nodeName&&"BODY"!=parent_node.nodeName;)parent_node=parent_node.parentNode;SlimStat.empty(parent_node.action)||(resource_url=parent_node.action);break;default:for(parent_node=target_node;"undefined"!=typeof parent_node&&"A"!=parent_node.nodeName&&"BODY"!=parent_node.nodeName;)parent_node=parent_node.parentNode;if("A"==parent_node.nodeName)if(target_node=parent_node,!SlimStat.empty(target_node.hash)&&target_node.hostname==location.hostname)resource_url=target_node.hash;else if(!SlimStat.empty(target_node.href)&&-1==target_node.href.indexOf("javascript:")){if(SlimStat.in_array(target_node.href,do_not_track))return!1;resource_url=target_node.href}"function"==typeof target_node.getAttribute&&(!SlimStat.empty(target_node.getAttribute("title"))&&note_array.push("Title:"+target_node.getAttribute("title")),!SlimStat.empty(target_node.getAttribute("id"))&&note_array.push("ID:"+target_node.getAttribute("id")));}return position="0,0",SlimStat.empty(window.event.pageX)||SlimStat.empty(window.event.pageY)?!SlimStat.empty(window.event.clientX)&&!SlimStat.empty(document.body.scrollLeft)&&!SlimStat.empty(document.documentElement.scrollLeft)&&(position=window.event.clientX+document.body.scrollLeft+document.documentElement.scrollLeft+","+window.event.clientY+document.body.scrollTop+document.documentElement.scrollTop):position=window.event.pageX+","+window.event.pageY,SlimStat.empty(window.event.type)||(note_array.push("type:"+window.event.type),"keypress"==window.event.type?note_array.push("keypress:"+String.fromCharCode(parseInt(window.event.which))):"click"==window.event.type&&note_array.push("which:"+window.event.which)),SlimStat.send_to_server("action=slimtrack&id="+SlimStatParams.id+"&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(resource_url)+"&pos="+position+"&no="+SlimStat._base64_encode(note_array.join(", ")),b),!0}};"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),SlimStat.add_event(window,"load",function(){slimstat_data="",use_beacon=!0,SlimStat.empty(SlimStatParams.id)?(slimstat_data="action=slimtrack&ref="+SlimStat._base64_encode(document.referrer)+"&res="+SlimStat._base64_encode(window.location.href),!SlimStat.empty(SlimStatParams.ci)&&(slimstat_data+="&ci="+SlimStatParams.ci),use_beacon=!1):0<parseInt(SlimStatParams.id)&&(slimstat_data="action=slimtrack&id="+SlimStatParams.id),0<slimstat_data.length&&setTimeout(function(){SlimStat.send_to_server(slimstat_data,use_beacon)},50),all_links=document.getElementsByTagName("a");for(var a=0;a<all_links.length;a++)SlimStat.add_event(all_links[a],"click",function(){SlimStat.ss_track()});SlimStat.show_optout_message()});
wp-slimstat.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Slimstat Analytics
4
  Plugin URI: https://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
- Version: 4.8.7
7
  Author: Jason Crouse
8
  Author URI: https://www.wp-slimstat.com/
9
  Text Domain: wp-slimstat
@@ -15,7 +15,7 @@ if ( !empty( wp_slimstat::$settings ) ) {
15
  }
16
 
17
  class wp_slimstat {
18
- public static $version = '4.8.7';
19
  public static $settings = array();
20
 
21
  public static $wpdb = '';
@@ -294,23 +294,25 @@ class wp_slimstat {
294
  unset( self::$stat[ 'id' ] );
295
 
296
  // Opt-out of tracking via cookie
297
- $cookie_names = array( 'slimstat_optout_tracking' => 'true' );
 
298
 
299
- if ( !empty( self::$settings[ 'opt_out_cookie_names' ] ) ) {
300
- $cookie_names = array();
301
 
302
- foreach ( self::string_to_array( self::$settings[ 'opt_out_cookie_names' ] ) as $a_cookie_pair ) {
303
- list( $name, $value ) = explode( '=', $a_cookie_pair );
304
 
305
- if ( !empty( $name ) && !empty( $value ) ) {
306
- $cookie_names[ $name ] = $value;
 
307
  }
308
  }
309
- }
310
 
311
- foreach ( $cookie_names as $a_name => $a_value ) {
312
- if ( isset( $_COOKIE[ $a_name ] ) && strpos( $_COOKIE[ $a_name ], $a_value ) !== false ) {
313
- return false;
 
314
  }
315
  }
316
 
@@ -471,7 +473,7 @@ class wp_slimstat {
471
  }
472
 
473
  // Number of results from query_posts
474
- if ( !empty( $GLOBALS[ 'wp_query' ]->found_posts ) ) {
475
  self::$stat[ 'notes' ][] = 'results:' . intval( $GLOBALS['wp_query']->found_posts );
476
  }
477
 
@@ -1329,7 +1331,7 @@ class wp_slimstat {
1329
  }
1330
  }
1331
 
1332
- $params[ 'oc' ] = implode( ',', $params[ 'opt_out_cookies' ] );
1333
  }
1334
 
1335
  if ( self::$settings[ 'javascript_mode' ] != 'on' ) {
3
  Plugin Name: Slimstat Analytics
4
  Plugin URI: https://wordpress.org/plugins/wp-slimstat/
5
  Description: The leading web analytics plugin for WordPress
6
+ Version: 4.8.7.1
7
  Author: Jason Crouse
8
  Author URI: https://www.wp-slimstat.com/
9
  Text Domain: wp-slimstat
15
  }
16
 
17
  class wp_slimstat {
18
+ public static $version = '4.8.7.1';
19
  public static $settings = array();
20
 
21
  public static $wpdb = '';
294
  unset( self::$stat[ 'id' ] );
295
 
296
  // Opt-out of tracking via cookie
297
+ if ( self::$settings[ 'display_opt_out' ] == 'on' ) {
298
+ $cookie_names = array( 'slimstat_optout_tracking' => 'true' );
299
 
300
+ if ( !empty( self::$settings[ 'opt_out_cookie_names' ] ) ) {
301
+ $cookie_names = array();
302
 
303
+ foreach ( self::string_to_array( self::$settings[ 'opt_out_cookie_names' ] ) as $a_cookie_pair ) {
304
+ list( $name, $value ) = explode( '=', $a_cookie_pair );
305
 
306
+ if ( !empty( $name ) && !empty( $value ) ) {
307
+ $cookie_names[ $name ] = $value;
308
+ }
309
  }
310
  }
 
311
 
312
+ foreach ( $cookie_names as $a_name => $a_value ) {
313
+ if ( isset( $_COOKIE[ $a_name ] ) && strpos( $_COOKIE[ $a_name ], $a_value ) !== false ) {
314
+ return false;
315
+ }
316
  }
317
  }
318
 
473
  }
474
 
475
  // Number of results from query_posts
476
+ if ( ( is_archive() || is_search() ) && !empty( $GLOBALS[ 'wp_query' ]->found_posts ) ) {
477
  self::$stat[ 'notes' ][] = 'results:' . intval( $GLOBALS['wp_query']->found_posts );
478
  }
479
 
1331
  }
1332
  }
1333
 
1334
+ $params[ 'oc' ] = implode( ',', $params[ 'oc' ] );
1335
  }
1336
 
1337
  if ( self::$settings[ 'javascript_mode' ] != 'on' ) {