This is how Slimstat collects its data about visitors and pageviews:


  1. When a page is dynamically generated by WordPress, an event (a "hook" in WordPress terminology) invokes the tracker [1]
  2. The tracker analyzes the request, and captures all the information received from the web server (IP address, URL of the resource, cookies, etc) [2]
  3. Based on the options configured by the administrator, Slimstat makes the appropriate decisions on how to treat/manipulate this information 
  4. If this request doesn't match any of the filters in the various blacklists available, Slimstat stores the manipulated information in wp_slim_stats


[1] http://codex.wordpress.org/Plugin_API/Action_Reference

[2] https://plugins.trac.wordpress.org/browser/wp-slimstat/trunk/wp-slimstat.php


Server and Client Mode


In "Server Mode", Slimstat executes the steps here above before the page is sent to the visitor; while in "Client Mode", a Javascript file is added to the page source code, and this will trigger the steps above AFTER the page has been loaded by the browser (similarly to what Google Analytics does). There are pros and cons in both approaches, and we let the user decide which one works best for their specific case/needs.


Report Engine


The report engine [3] retrieves the information from the database and, executing a predetermined list of SQL queries, calculates all the metrics that compose all the reports visualized in the admin. The report engine is also in charge of parsing all the filters (browser equals Firefox, Permalink contains /articles/, etc) and converting them to SQL code to be used during the requests.


[3] https://plugins.trac.wordpress.org/browser/wp-slimstat/trunk/admin/view/wp-slimstat-db.php