Slimstat Analytics - Version 4.8.7.2

Version Description

  • [Fix] The new tracker was having problems recording clicks on SVG elements within a link (thank you, pollensteyn).
  • [Fix] The event handler is now capable of tracking events on BUTTONs within FORM elements.
  • [Fix] Permalinks containing post query strings were not being recorded as expected.
Download this release

Release Info

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

Code changes from version 4.8.7.1 to 4.8.7.2

Files changed (5) hide show
  1. CHANGELOG.md +5 -101
  2. readme.txt +6 -1
  3. wp-slimstat.js +25 -33
  4. wp-slimstat.min.js +1 -1
  5. wp-slimstat.php +15 -21
CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
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.
@@ -17,104 +22,3 @@
17
  * [Fix] A bug was affecting certain shortcodes when PHP 7.2 was enabled (thank you, Peter).
18
  * [Fix] Emptying one of the settings and saving did not produce the desired effect.
19
 
20
- ### 4.8.6.1 ###
21
- * [Fix] A regression bug was introduced in 4.8.6, affecting some of the shortcodes and reports.
22
-
23
- ### 4.8.6 ###
24
- * [New] Slimstat can now track most WordPress redirects and mark them with the appropriate content type.
25
- * [Update] The GDPR compliance through third-party tools is now more flexible and allows admins to specify name/value pairs so that the cookie must CONTAIN the given string.
26
- * [Update] Simplified code that manages the sidebar menu.
27
- * [Update] Reorganized code that manages the plugin options.
28
- * [Update] Rewrote the portion of code that manages tracker errors, which are now saved in a separate field in the database.
29
- * [Update] Reintroduced feature to hide certain report pages when no reports are assigned to them.
30
- * [Update] Decrease the number of database requests needed to record a new pageview.
31
- * [Fix] Entries with a trailing slash and ones without were being listed as separate in Top Web Pages.
32
- * [Fix] Typo in one of the conditions definining the Top Bots report.
33
-
34
- ### 4.8.5.1 ###
35
- * [Fix] A bug was affecting the way shortcodes were being displayed on the website (thank you, [inndesign](https://wordpress.org/support/topic/crashes-avada-theme-in-chrome/)).
36
- * [Fix] Some icons in the Access Log were broken and not displayed as expected.
37
- * [Fix] Added extra code to make sure a callback function is defined for any given report.
38
- * [Fix] Top reports where displaying an incorrect percentage value on the WordPress dashboard (thank you, [scruffy1 and a305587](https://wordpress.org/support/topic/dashboard-widgets-showing-0)).
39
-
40
- ### 4.8.5 ###
41
- * [New] Introduced option to not track pageviews based on the ACCEPT-LANGUAGE header sent by the browser.
42
- * [New] Introduced option to display a pageview count instead of the percentage in Top reports.
43
- * [New] Introduced two new reports under the Audience tab: Tob Bots and Top Human Browsers.
44
- * [Update] Removed the option to hide reports on tabs, as it was confusing users who couldn't find them. Now you can simply use the Customizer to arrange your reports, and place the ones you don't need in the Inactive box.
45
- * [Update] Rewritten the code that manages which reports are displayed on which screen (Customizer), streamlined data structures and optimized their use. Please update all the add-ons to the latest version available. Don't hesitate to contact us if you have any questions!
46
- * [Fix] The HTML markup in the opt-out message field was being stripped out (thank you, [paulmcmanus](https://wordpress.org/support/topic/saving-settings-flips-opt-out-message-to-plain-text/)).
47
- * [Fix] Reports could not be properly deleted in the Customizer, if the Slimstat menu was displayed in the Admin Bar.
48
- * [Fix] A fatal error thrown by the Maxmind library when the data file is corrupted has been addressed.
49
- * [Fix] The icon filename for Windows 8.1 was incorrect (thank you, Dimitri).
50
-
51
- ### 4.8.4.1 ###
52
- * [Note] As anticipated a few weeks ago, this update drops the information about your visitors' browser plugins, which had been deprecated as not useful and oftentimes unreliable. Please make sure to backup your Slimstat tables if you need to preserve this information for some reason.
53
- * [Update] We received quite a few messages complaining about our decision to change the default position of the Slimstat menu from the sidebar to the admin bar. We are rolling back this change, and we apologize for any confusion this might have caused.
54
- * [Update] Added visitor's language to the Activity Log report.
55
- * [Update] Introduced code optimizations to improve performance when localizing strings related to operating systems, languages, countries, etc.
56
- * [Fix] Page URLs were not being displayed correctly if the option to display page titles was turned off.
57
- * [Fix] Not storing empty values in the database: leave as NULL. This will squeeze a few more bytes out of each row stored in the database.
58
-
59
- ### 4.8.4 ###
60
- * [Note] If you're using any of our premium add-ons, please make sure to update them to the latest version available (see Slimstat > Add-ons) as we've updated some references in our code.
61
- * [Note] We recently received an email from one of our users suggesting that we replace the line charts currently used to display reports over a timeline with **bar charts**, because 'the number of pageviews and IPs are discrete numbers, hence they should also be presented as discrete numbers', according to him. What do you think? Please let us know by [sending us a message](https://support.wp-slimstat.com/) on our support platform. Thank you.
62
- * [Update] Renamed a few files in the admin. If you're including Slimstat libraries in your custom code, please make sure to check that your references are up-to-date. Also, make sure to clear your cache if you page layout doesn't look right.
63
- * [Update] [AmCharts](https://www.amcharts.com/javascript-charts/), the library used to render all of our charts, has been updated to version 4.5.3.
64
- * [Update] When functioning in Client mode, the tracker will now not ignore bots, spiders and the like automatically. Please use the appropriate option under Settings > Exclusions if you would like to ignore bots. This solves an incompatibility issue with some caching plugins which "prefetch" the website, presenting themselves as bots.
65
- * [Update] Removed tracker notice field under Settings > Maintenance as it was confusing many people and generating extra work for our customer service team.
66
- * [Update] Removed option to not track "client properties" like screen resolution, etc. Also, removed option to not honor DNT headers, as we received complaints from privacy activists on this matter.
67
- * [Update] Removed option to change date/time formats and numeric separators: Slimstat will now use the WordPress settings to adjust its behavior.
68
- * [Update] Removed 'About Slimstat' report, given that some of the information in it has been moved to the Settings.
69
- * [Update] Removed unused strings, improved contextual descriptions and applied consistent naming conventions across our codebase (first pass).
70
- * [Update] The Slimstat admin menu is now added to the Admin Bar by default. Please go to Settings > Basic > WordPress Integration and change the corresponding option, if you prefer to use the side menu instead.
71
- * [Update] Enabled code editor in Settings.
72
- * [Update] Implemented a new optimized function to retrieve the post count on the Edit Posts/Pages/CPTs screens. Thank you, Lance.
73
- * [Update] Improved browser detection feature, which will now fallback to the heuristic function if the Browscap data file doesn't contain an exact match for a given browser. This usually happens whenever a new browser version is released, which is not yet included in the data file.
74
- * [Update] Option to track same-domain referrers is now deactivated by default on new installations.
75
- * [Update] Enabled wildcards on the exclusion rule by capability.
76
- * [Update] Improved the overall source code readability score. Now you don't have any other excuses to not contribute to this project!
77
- * [Update] Table indexes are now enabled by default in the database.
78
- * [Update] Added new WordPress filter to the Browscap Library, so that third-party tools can manipulate the data before it's returned to the tracker.
79
- * [Update] Added [nonce](https://wordpress.org/support/article/glossary/#nonce) to Settings page for improved security.
80
-
81
- ### 4.8.3 ###
82
- * [Note] Thank you for all the great feedback you provided to our unofficial survey about retiring the 'browser plugins' feature. The vast majority of those who replied confirmed what we already thought. Please consider backing up your database if you would like to preserve this information for future analysis. With this update, we removed the portion of code that tracks that information, but kept the existing data untouched. In a couple of releases, code will be added to actually drop this column from the database.
83
- * [New] If English is not your primary languge, Slimstat will now display a notice asking for your help to [translate our plugin](https://translate.wordpress.org/projects/wp-plugins/wp-slimstat/) in your language. Please consider volunteering for this great opportunity to help our community!
84
- * [Update] We are working with the GlotPress community to improve the way Slimstat speaks your language. We had to change the way certain strings are defined in our source code. Please let us know if you notice any unexpected behavior when analyzing languages, countries and operating systems.
85
- * [Update] Removed Facebook rankings metrics, as the API has been deprecated and the new one is not accessible without a private token.
86
- * [Update] MozRank has been deprecated, we have replaced it with the Domain Authority metric.
87
- * [Update] Spring cleaning in the 'admin notices' department: removed some obsolete CSS code, replaced by built-in WP classes and definitions.
88
- * [Fix] Changed the default minimum capability to access the reports from 'activate_plugins' to 'manage_options', so that regular administrators (a.k.a. non-super admins) in a multisite environment can still see their own reports (thank you, [homepageware](https://wordpress.org/support/topic/slimstat-and-multisite/)). This update does not affect existing installations: if you want regular admins to see their own stats, please go to Slimstat > Settings > Access Control and change the values in the corresponding fields.
89
- * [Fix] The autorefresh feature for the Access Log was not working as expected. Thank you to all the users who patiently worked with us to identify the issue.
90
- * [Fix] A conflict between the Async loader and AmCharts 4 was causing the Screen Options tab to not work as expected (thank you, [softfully](https://wordpress.org/support/topic/screen-options-doesnt-open/)).
91
- * [Fix] Removed unused setting 'Expand Reports'
92
-
93
- ### 4.8.2 ###
94
- * [Note] Our team has been contemplating the idea of deprecating the information collected about your visitors' *browser plugins* (Java, PDF reader, RealView player, Silverlight, etc). In this day and age, where browsers use either built-in functionality to provide those features, or extensions that cannot be tracked for privacy purposes, it feels anachronistic to continue collecting this outdated information. By getting rid of this specific feature, we can streamline our code, improve performance, and reduce the database size. However, we wanted to hear from our users before anything is actually implemented. Please do not hesitate [to let us know](https://support.wp-slimstat.com) if you are using the 'browser plugins' field for your reporting needs.
95
- * [New] Many CRM integration plugins rely mostly on the user emails, not usernames. For this reason, a new email field has been added to the database (thank you, [sandrodz](https://github.com/sandrodz)).
96
- * [Update] Changed the preset intervals in the date filter dropdown so that you can get a day over day comparison (Monday over Monday, etc) for improved accuracy.
97
- * [Update] [AmCharts](https://www.amcharts.com/javascript-charts/), the library used to render all of our charts, has been updated to version 4.4.9.
98
- * [Fix] The countdown timer on the Access Log was not working as expected (thank you, [anniest](https://wordpress.org/support/topic/no-refresh-2/)).
99
- * [Fix] The countdown timer was causing an warning message to appear on other screens.
100
- * [Fix] Minor aesthetic improvements.
101
-
102
- ### 4.8.1 ###
103
- * [Update] Async mode will now serialize concurrent requests to the backend to optimize performance and reduce server load.
104
- * [Fix] Addressed a remote XSS vulnerability disclosed by Sucuri/GoDaddy.
105
- * [Fix] Charts were displaying the wrong label for certain values (thank you, Alex).
106
-
107
- ### 4.8 ###
108
- * [Note] Now that we have a cleaner foundation to build on, it's time to start introducing new reports and new ways to segment your audience and the traffic they generate. While our users test the latest changes and updates (to confirm that the foundation is indeed solid and bug-free), we are hard at work implementing the first batch of new reports. Some of them will be made available in the free version, while others will be added to our premium add-on, [User Overview](https://www.wp-slimstat.com/downloads/user-overview/). And we need your help! If you think that a specific report should be added to Slimstat, please do not hesitate to let us know!
109
- * [Note] Worried about the recent [news regarding jQuery vulnerabilities](https://www.zdnet.com/article/popular-jquery-javascript-library-impacted-by-prototype-pollution-flaw/)? Slimstat doesn't use jQuery as a dependency, so you can sleep tight knowing that your website will not be affected.
110
- * [Update] [AmCharts](https://www.amcharts.com/javascript-charts/), the library used to render all of our charts, has been updated to version 4. This new release is not backward compatible, so the code to integrate it with Slimstat had to be completely rewritten. Please let us know if you notice any issues.
111
- * [Update] [Plugin Update Checker](https://github.com/YahnisElsts/plugin-update-checker), the library we use to check if a new version of our premium add-ons is available for download, has been update to version 4.6.
112
- * [Update] If you're using our partner's CDN functionality (JsDelivr) to load the tracker, their link is now always loaded over HTTPS for added security.
113
- * [Update] Switched the Add-on Update checker URL to HTTPS, for added security (thank you, Peter).
114
- * [Update] Changed the protocol of all the URLs used within Slimstat, including references to our documentation, to HTTPS.
115
- * [Update] Added icon to geolocate Originating IP addresses, when detected.
116
- * [Fix] The optout cookie path was not being set correctly (thank you, [ralfkerkhoff](https://wordpress.org/support/topic/opt-out-cookie-per-page/)).
117
- * [Fix] Google seems to be using a new User Agent string for its "mobile" crawler, which was causing Slimstat from incorrectly identifying visits as coming from mobile devices, instead of bots (thank you, Ron).
118
- * [Fix] An error was being returned if SVG elements were using the A tag on a page (thank you, [snaphappyme](https://wordpress.org/support/topic/uncaught-typeerror-all_linksn-href-indexof/)).
119
- * [Fix] A bug was causing Slimstat to incorrectly geolocate visits to websites behind a Cloudflare load balancer. Please update the IP Address Fix add-on as well.
120
- * [Fix] Tweaked the formula to determine your website bounce rate, and updated the associated description to better reflect the underlying calculations.
1
  ## Changelog ##
2
+ ### 4.8.7.2 ###
3
+ * [Fix] The new tracker was having problems recording clicks on SVG elements within a link (thank you, [pollensteyn](https://wordpress.org/support/topic/javascript-error-typeerror/#post-11926542)).
4
+ * [Fix] The event handler is now capable of tracking events on BUTTONs within FORM elements.
5
+ * [Fix] Permalinks containing post query strings were not being recorded as expected.
6
+
7
  ### 4.8.7.1 ###
8
  * [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.
9
  * [Fix] A warning message was being displayed when enabling the opt-out feature with certain versions of PHP.
22
  * [Fix] A bug was affecting certain shortcodes when PHP 7.2 was enabled (thank you, Peter).
23
  * [Fix] Emptying one of the settings and saving did not produce the desired effect.
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.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,6 +60,11 @@ 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.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.
6
  Requires at least: 4.9
7
  Requires PHP: 5.2
8
  Tested up to: 5.2
9
+ Stable tag: 4.8.7.2
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.2 =
64
+ * [Fix] The new tracker was having problems recording clicks on SVG elements within a link (thank you, [pollensteyn](https://wordpress.org/support/topic/javascript-error-typeerror/#post-11926542)).
65
+ * [Fix] The event handler is now capable of tracking events on BUTTONs within FORM elements.
66
+ * [Fix] Permalinks containing post query strings were not being recorded as expected.
67
+
68
  = 4.8.7.1 =
69
  * [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.
70
  * [Fix] A warning message was being displayed when enabling the opt-out feature with certain versions of PHP.
wp-slimstat.js CHANGED
@@ -266,43 +266,28 @@ var SlimStat = {
266
  // Do not track events on elements with given class names or rel attributes
267
  do_not_track = !SlimStat.empty( SlimStatParams.dnt ) ? SlimStatParams.dnt.split( ',' ) : [];
268
 
269
- if ( !SlimStat.empty( do_not_track.length ) ) {
270
- target_classes = !SlimStat.empty( target_node.className ) ? target_node.className.split( " " ) : [];
271
- if ( target_classes.filter( value => -1 !== do_not_track.indexOf( value ) ).length != 0 || ( !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 ) ) ) {
272
- return false;
273
- }
274
- }
275
-
276
  // Different elements have different properties to record...
277
  if ( !SlimStat.empty( target_node.nodeName ) ) {
278
  switch ( target_node.nodeName ) {
279
- case "FORM":
280
- if ( !SlimStat.empty( target_node.action ) ) {
281
- resource_url = target_node.action;
282
- }
283
- break;
284
-
285
  case "INPUT":
 
286
  // Let's look for a FORM element
287
- parent_node = target_node.parentNode;
288
- while ( "undefined" != typeof parent_node && parent_node.nodeName != "FORM" && parent_node.nodeName != "BODY" ) {
289
- parent_node = parent_node.parentNode;
290
  }
291
- if ( !SlimStat.empty( parent_node.action ) ) {
292
- resource_url = parent_node.action;
 
293
  }
294
  break;
295
 
296
  default:
297
  // Is this a link?
298
- parent_node = target_node;
299
- while ( "undefined" != typeof parent_node && parent_node.nodeName != "A" && parent_node.nodeName != "BODY" ) {
300
- parent_node = parent_node.parentNode;
301
  }
302
 
303
- if ( parent_node.nodeName == "A" ) {
304
- target_node = parent_node;
305
-
306
  // Anchor in the same page
307
  if ( !SlimStat.empty( target_node.hash ) && target_node.hostname == location.hostname ) {
308
  resource_url = target_node.hash;
@@ -316,20 +301,27 @@ var SlimStat = {
316
  }
317
 
318
  resource_url = target_node.href;
319
-
320
  }
321
- }
322
 
323
- // If this element has a title, we can record that as well
324
- if ( "function" == typeof target_node.getAttribute ) {
325
- if ( !SlimStat.empty( target_node.getAttribute( "title" ) ) ) {
326
- note_array.push( "Title:" + target_node.getAttribute( "title" ) );
327
- }
328
- if ( !SlimStat.empty( target_node.getAttribute( "id" ) ) ) {
329
- note_array.push( "ID:" + target_node.getAttribute( "id" ) );
 
330
  }
331
  }
332
  }
 
 
 
 
 
 
 
 
333
  }
334
 
335
  // Event coordinates
266
  // Do not track events on elements with given class names or rel attributes
267
  do_not_track = !SlimStat.empty( SlimStatParams.dnt ) ? SlimStatParams.dnt.split( ',' ) : [];
268
 
 
 
 
 
 
 
 
269
  // Different elements have different properties to record...
270
  if ( !SlimStat.empty( target_node.nodeName ) ) {
271
  switch ( target_node.nodeName ) {
 
 
 
 
 
 
272
  case "INPUT":
273
+ case "BUTTON":
274
  // Let's look for a FORM element
275
+ while ( !SlimStat.empty( target_node ) && !SlimStat.empty( target_node.nodeName ) && target_node.nodeName.toLowerCase() != "form" ) {
276
+ target_node = target_node.parentNode;
 
277
  }
278
+
279
+ if ( !SlimStat.empty( target_node ) && !SlimStat.empty( target_node.nodeName ) && !SlimStat.empty( target_node.action ) ) {
280
+ resource_url = target_node.action;
281
  }
282
  break;
283
 
284
  default:
285
  // Is this a link?
286
+ while ( !SlimStat.empty( target_node ) && !SlimStat.empty( target_node.nodeName ) && target_node.nodeName.toLowerCase() != "a" ) {
287
+ target_node = target_node.parentNode;
 
288
  }
289
 
290
+ if ( !SlimStat.empty( target_node ) ) {
 
 
291
  // Anchor in the same page
292
  if ( !SlimStat.empty( target_node.hash ) && target_node.hostname == location.hostname ) {
293
  resource_url = target_node.hash;
301
  }
302
 
303
  resource_url = target_node.href;
 
304
  }
 
305
 
306
+ // If this element has a title, we can record that as well
307
+ if ( "function" == typeof target_node.getAttribute ) {
308
+ if ( !SlimStat.empty( target_node.getAttribute( "title" ) ) ) {
309
+ note_array.push( "Title:" + target_node.getAttribute( "title" ) );
310
+ }
311
+ if ( !SlimStat.empty( target_node.getAttribute( "id" ) ) ) {
312
+ note_array.push( "ID:" + target_node.getAttribute( "id" ) );
313
+ }
314
  }
315
  }
316
  }
317
+
318
+ if ( !SlimStat.empty( do_not_track.length ) && !SlimStat.empty( target_node ) ) {
319
+ target_classes = !SlimStat.empty( target_node.className ) ? target_node.className.split( " " ) : [];
320
+
321
+ if ( target_classes.filter( value => -1 !== do_not_track.indexOf( value ) ).length != 0 || ( !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 ) ) ) {
322
+ return false;
323
+ }
324
+ }
325
  }
326
 
327
  // Event coordinates
wp-slimstat.min.js CHANGED
@@ -1 +1 @@
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()});
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(target_node.nodeName)){switch(target_node.nodeName){case"INPUT":case"BUTTON":for(;!SlimStat.empty(target_node)&&!SlimStat.empty(target_node.nodeName)&&"form"!=target_node.nodeName.toLowerCase();)target_node=target_node.parentNode;SlimStat.empty(target_node)||SlimStat.empty(target_node.nodeName)||SlimStat.empty(target_node.action)||(resource_url=target_node.action);break;default:for(;!SlimStat.empty(target_node)&&!SlimStat.empty(target_node.nodeName)&&"a"!=target_node.nodeName.toLowerCase();)target_node=target_node.parentNode;if(!SlimStat.empty(target_node)){if(!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")))}}if(!SlimStat.empty(do_not_track.length)&&!SlimStat.empty(target_node)&&(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}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.1
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.1';
19
  public static $settings = array();
20
 
21
  public static $wpdb = '';
@@ -389,22 +389,22 @@ class wp_slimstat {
389
  // Resource URL
390
  if ( !isset( self::$stat[ 'resource' ] ) ) {
391
  self::$stat[ 'resource' ] = self::get_request_uri();
 
392
 
393
- // Is this a 'seriously malformed' URL?
394
- $parsed_url = parse_url( self::$stat[ 'resource' ] );
395
- if ( !$parsed_url ) {
396
- $error = self::_log_error( 203 );
397
- return false;
398
- }
399
-
400
- // Is this resource blacklisted?
401
- if ( !empty( self::$settings[ 'ignore_resources' ] ) && self::_is_blacklisted( self::$stat[ 'resource' ], self::$settings[ 'ignore_resources' ] ) ) {
402
- return false;
403
- }
404
  }
405
 
406
  // Don't store the domain name in the database
407
- self::$stat[ 'resource' ] = parse_url( self::$stat[ 'resource' ], PHP_URL_PATH );
 
 
 
 
 
408
 
409
  // Referrer URL
410
  if ( !isset( self::$stat[ 'referer' ] ) && !empty( $_SERVER[ 'HTTP_REFERER' ] ) ) {
@@ -1551,12 +1551,6 @@ class wp_slimstat {
1551
  }
1552
  }
1553
 
1554
- // self::$wpdb->query( self::$wpdb->prepare( "
1555
- // UPDATE IGNORE {$GLOBALS[ 'wpdb' ]->prefix}slim_stats
1556
- // SET " . implode( ' = %s, ', array_keys( $_data ) ) . " = %s
1557
- // WHERE id = $id", $_data
1558
- // ) );
1559
-
1560
  self::$wpdb->update(
1561
  $GLOBALS[ 'wpdb' ]->prefix . 'slim_stats',
1562
  $_data,
@@ -1613,7 +1607,7 @@ class wp_slimstat {
1613
  }
1614
  else {
1615
  // We weren't lucky, but there's still hope
1616
- foreach( array( 'k', 'p', 'q', 'qt', 'query', 's' ) as $a_format ) {
1617
  if ( !empty( $query[ $a_format ] ) ) {
1618
  $searchterms = str_replace( '\\', '', trim( urldecode( $query[ $a_format ] ) ) );
1619
  break;
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.2
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.2';
19
  public static $settings = array();
20
 
21
  public static $wpdb = '';
389
  // Resource URL
390
  if ( !isset( self::$stat[ 'resource' ] ) ) {
391
  self::$stat[ 'resource' ] = self::get_request_uri();
392
+ }
393
 
394
+ // Is this a 'seriously malformed' URL?
395
+ $parsed_url = parse_url( self::$stat[ 'resource' ] );
396
+ if ( !$parsed_url ) {
397
+ $error = self::_log_error( 203 );
398
+ return false;
 
 
 
 
 
 
399
  }
400
 
401
  // Don't store the domain name in the database
402
+ self::$stat[ 'resource' ] = $parsed_url[ 'path' ] . ( !empty( $parsed_url[ 'query' ] ) ? '?' . $parsed_url[ 'query' ] : '' );
403
+
404
+ // Is this resource blacklisted?
405
+ if ( !empty( self::$settings[ 'ignore_resources' ] ) && self::_is_blacklisted( self::$stat[ 'resource' ], self::$settings[ 'ignore_resources' ] ) ) {
406
+ return false;
407
+ }
408
 
409
  // Referrer URL
410
  if ( !isset( self::$stat[ 'referer' ] ) && !empty( $_SERVER[ 'HTTP_REFERER' ] ) ) {
1551
  }
1552
  }
1553
 
 
 
 
 
 
 
1554
  self::$wpdb->update(
1555
  $GLOBALS[ 'wpdb' ]->prefix . 'slim_stats',
1556
  $_data,
1607
  }
1608
  else {
1609
  // We weren't lucky, but there's still hope
1610
+ foreach( array( 'k', 'q', 'qt', 'query', 's' ) as $a_format ) {
1611
  if ( !empty( $query[ $a_format ] ) ) {
1612
  $searchterms = str_replace( '\\', '', trim( urldecode( $query[ $a_format ] ) ) );
1613
  break;