=== ecSTATic === Contributors: Mike Soja Donate link: http://www.kayak2u.com/ Tags: visitor stats, access management Requires at least: 2.7 Tested up to: 2.9.2 Stable tag: 0.76 Faster, Smaller, Non-Ecological Real-Time Visitor Stats and Management for your Wordpress Blog. == Description == EcSTATic is a fast, flexible, and feature packed visitor logger with a small footprint, for Wordpress blogs. It facilitates tracking visitors, monitoring the multitudes of bots and spiders, and helps block annoying trackback spammers. It even squirts out a graph or two, if needed. = Features = * Code in two main sections: A small portion that quickly and efficiently records visitors, and a larger, but still relatively small, suite of files to provide the administrator views. * More than two dozen options can be set, including when to purge old data, how many hours of most recent visitors to display in main panels, whether to block Mozilla's link prefetching annoyances, ordering of graph displays, whether to log logged-in users or not, how long to wait before counting returning visitor as a *new* hit, and more. * Extensive use of wpdb->prepare functions for safe database insertions. * Options data validated and kept within bounds. * Keeps running total of all visitors. * Panels separate visitors by Http visitors, RSS reader, Spider/Bot, and blocked or KILLed entities. Alternatively, all may be viewed in one long sequential list that shows date, time, IP, domain, browser, OS, Page requested, Referrer, and score. All entries have a "more" link to more detailed information. * Shows visitors by IP, User Agent, Referrer, Requested URI, and Domain. * Allows user to classify visitors as Spider/Bot by IP, IP range, User Agent token, or Referrer token, with a few simple clicks. Existing entries may just as easily be removed. * A KILL table, for blocking miscreants and other ne'erdowells completely, is set up exactly like the Spider/Bot table. * A NoLog table, for repetitive visitors one may not want or need to log, is set up exactly like the Spider/Bot and KILL tables. * A WhiteList table, for excepting people from the KILL table, or otherwise passing them through, is set up exactly like the Spider/Bot, KILL, and NOLog tables. * XML import and export functions are built into the Spider/Bot, KILL, NoLog, and WhiteList tables. * The Spider/Bot, KILL, NoLog, and WhiteList tables record when the entities were "last seen", and are sortable across columns. * Provides a simple scoring system to block visitors based on a combination of IP, User Agent, Referrer, Requested URI, and seven default items with user-settable thresholds. * Coughs up graphs for Browsers, Operating Systems, Spiders/Bots, Referrers, Search Engine Referrers, Search Phrases, Pages, Categories, and Feed Reads. * Widgetized! Uses the WordPress widget class (introduced in WordPress version 2.8) to facilitate sharing stats on one's blog pages. Currently displayable stats are "Visitors", "All Pages", "Feed Reeds", "Spider/Bots", "This Page", "Viz Today", "Pages Today", "RSS Today", and "Bots Today". All labels are customizeable. The display order can be overridden. Style-able via CSS (with included CSS file to help.) * Has a simple search function that plows through IPs, user agents, referrers, requested uris, and saved domain names. * Details pages are fitted with WHOIS and reverse IP lookup functions. Has two hooks to access Maxmind's geolocation database, and links to Google Maps. * Parses search engine referrer strings to pluck out the search phrase, and builds a link that attempts to reproduce the search that brought the visitor to one's site. Test functions facilitate "training" the parser. The table that holds the parameters may be exported to an xml file, or supplemental tables imported. * Banner graph at the top of most pages (may be toggled on/off in options) displays the previous year's visits by month, the current day, month, and year stats, and a "daily" graph for the 7 to 90 most recent days, user selectable. * Comes with a rudimentary Help! file. * Many helpful little details. * Removes itself completely if you decide to uninstall it. == Installation == 1. Create a folder/directory named "ecstatic" in your "/wp-content/plugins/" folder/directory 2. Upload the ecSTATic files to the newly created ecstatic folder/directory 3. Activate the plugin through the 'Plugins' menu in WordPress 4. ecSTATic picks it up from there. Look for a new button at the lower end of the dashboard menu buttons. Allow a little time for visitors stats to accrue. Set your options. == Frequently Asked Questions ==

Q. Can you write a script to import my other not-so-handy stats package stats into the ecSTATic database?

A. Maybe tomorrow. Remind me, tomorrow.

== Screenshots == 1. Main Page `screenshot-1.png` 2. Options Page `screenshot-2.png` 3. Details Page `screenshot-3.png` == Changelog == = 0.76 = * Let's try this again.  In trying to fix one small bug last night, I committed a whole bunch of changes without having checked them all out, and still didn't fix the bug having to do with with the malformed (and spam-like) referrer.  Now, instead of prepending the "http://" that wasn't there, the malign referrer string is left as is, but highlighted in red, and NOT wrapped in an anchor. = 0.75 = * Broke something last night having to do with spider/bot detection.  Might have affected only my copy, but I've put a check in.  If some bots have been marked as non-bots in the db, click the main menu "Details" entry, and they should set properly. * * And one more time.  Fixed! * And, a few minutes later... one more introduced-bug fix in the user agent parser. * Fixed bug in Referrer mangler.  When a referrer came in without a "http://" or "www", and was wrapped in an anchor, the browser took it for a relative link.  Now the "http://" is tacked on the front. * Added a new setting to set the Purge period for Feed Readers.  Those hits do pile up.  Default is 30 days, in Options. * Added cheap check for Spider/Bots not in the big table.  Looks for "bot", "spider", and "crawl". * Eliminated error when trying to export empty tables. * More playing with the WhoIS routines. * More playing with the CSS file. = 0.71 = * Reworked the WhoIS routines some more.  How one tiny set of functions can bear so much indulgence... But it now performs more like I intended it to, rolling back to the last response containing usable info.  And the country code translation is more reliable, and faster. * Updated the "country_file.txt" file.  Bolivia has gone from "BOLIVIA;BO" to "BOLIVIA, PLURINATIONAL STATE OF;BO". * -- * Added a new WhiteList Table.  The old WhiteList table was more of a NoLog Table, and still exists, but no longer pretends to be a WhiteList Table.  Entities listed in the NoLog Table are not logged.  Entities in the WhiteList Table are given a total score of -1 irrespective of other factors, and logged along with everyone else (unless listed in the NoLog Table.)  Entities in the WhiteList Table will not be KILLed even if listed in the KILL table.  The old NoLog table is still named "aux_nolog".  The new WhiteList table is named "aux_wlist".  Additions and deletions are made on the Details page.  Note: In the Details pages, WhiteListed entities are shown with the scores they *would* have gotten if not WhiteListed, highlighted in tasteful green. * Put the NoLog and WhiteList tables in their own tab on the Details page. = 0.70 = * Rewrote everything.  Almost.  :)  In further facilitating widget action, it was necessary to put spider/bot-feed differentiation into the main hit-recording function.  All the action is live, now.  I'd resisted it for performance reasons (I hate the initial lag one gets on certain websites), but was surprised at how little code it took to pull it off.  So, there's no lag, and much increased efficiency, elsewhere.  Was able to eliminate about 4kbs of code in the administrative routines.  Widget functions are now real time. * Added several "parameters" to the widget, with a "Customize" option.  Also, precede custom labels with a number and dash ("1-", "2-", etc.), or just enter a number and dash in an otherwise blank Customize box, to override the default widget display order. * Fixed an old mistake in a MySQL query string. * The big .zip file now includes the file "ecstatic_widget_table.css" which contains a few lines of CSS to cut and paste into one's "style.css" file (in one's theme folder), or to use as a guide, to facilitate styling the new Widget output. = 0.60 = * Widget!  Put your visitor/page stats in your sidebar.  The widget code must be Enabled on the Options page or it won't show up in WordPress's Admin Widget section, which allows those who don't want it to avoid the overhead of having it always there.  More variables to come. * Cleaned up more code and got around to some dangling problems.  Now, when entries are added to or deleted from the aux_spider table, the matching entries in the user_agents and ips tables are reset for re-evaluation. = 0.51 = * Rewrote the ecSTATic logo title and banner graph routines, making them much faster by eliminating multiple database reads, while at the same time putting more info on the screen.  There's now a graph of monthly stats, going back a year plus one, and also a day-month-year running total in a box (with secret clickable row titles!)  Monthly and yearly totals on the KILL line will be affected by one's Purge settings, since KILLs are not recorded in the cumulative table with the other stats. * Rewrote the routine that adds hits to the database.  Previously, hits from search engine spiders and bots contributed to the individual page tallies.  Now, hits from known spiders and bots will not add to the totals shown on the SomeStats page. * Moved more styling into the ecstatic.css file.  For those so inclined, changing the colors of the graph bars is now more easily accomplished. * The Maleagents entries now show which token identified the entry to be KILLed, obviating the need to click the "more" button to get the info. * Refined code in Search Engine Referral parse routines.  Generalized the special Google parse. * Updated aux_se.xml with Google Translate entry. = 0.50 = * Rewrote the Purge routines.  MySQL is relatively SLOW when it comes to deleting rows from tables.  The ecSTATic function is now more efficient than it was, but can be slow if one *changes* Purge settings from high to low so that a lot of data has to be deleted all at once. In other words, if you start out wanting to save all data forever, and then change your mind after a couple years and only want to keep data for a week, it's going to be slow.  Apparently, it is faster to write all the data not being purged to a new table, delete the old table, and rename the new to the old, but I'm resisting that strategem for the time being. * Also related to Purge: Setting either purge option to zero (0) days turns purging off for that parameter. * Fixed stuff related to Domain acquisition and display that I'd overlooked. * Cut the fluff out of the javascript table sorting script, and added a switch (not user selectable) to turn reverse sort on and off. * Changed the "Spider/Bot", "Kill", "NoLog" form handler.  Now, when the user tries to add a token that already exists, insteading of sparking an error and sending the user back to square one, the program gives an alert, and then goes ahead and modifies the name associated with the submitted token.  It facilitates renaming existing entries.  Before, one had to delete the entry, and enter it all anew. * Rewrote the Referrer functions with an aim to addressing the Search Engine Referrer db table that I'd almost forgotten about.  Another field ("path") has been added to the "aux_se" database table.  Referrers from non-shy search engines are now un-mangled so that one can duplicate the search the visitor undertook to arrive at one's site.  It isn't as simple as encasing the incoming referrer in an href and letting it fly.  Google, for instance.  Anyway, Search Engine referrers are now echoed as TWO links.  The left link, the Search Engine name, goes to a new ecSTATic page where one can delete or add entries to the "aux_se" db table.  The right link, built around the search key words, should call up the referring search engine with those words.  Until the thing is tuned properly, some links are just guesses.  Etc.  The new "Search Engine Variable Signatures" page is quite complicated, affording lots of playing around, if one is given to that sort of thing. * Added "aux_nolog" to uninstall.php, which I had neglected to do before * Put almost all form processing code in its own file: "ecstatic_forms.php".  Helps in organization, and should speed proceesing slightly, while lightening the load on non-form processing accesses. * Moved more styling into ecstatic.css. * And last, but certainly not least, added XML import and export functions to the Spider/Bot, KILL, NoLog, and Search Engine Referral tables.  All are XML version 1.0 compliant.  Look for two buttons at the bottom of each table.  "Export" makes it easy to back up your tables.  "Import" checks each record row for pertinent matches, before adding to the existing entries, leaving existing data untouched.  For now, the "Import" file names are hard coded... = 0.21 = * Refined Post-title and -name mangler. * Excised the redundant "Remove Entry from X db" form where X was either "Spider/Bot" or "KILL".  Makes it possible to add secondary tokens when one token is already in play for a particular entry.  Deleting entries is now undertaken solely in the "Spider/Bot - Kill" tab tables. * Added mal_uri parameter to default scoring options.  Program checks Requested URI for "http://" which has been cropping up in my logs, and appears to be some kind of redirect attempt.  Wordpress's own redirect attempts are passed through. Default score for mal_uri is a killing 10, settable on the Options page.  Lends itself to other checks, with simple code, as needed. * Added a "Domain" tab to the Details page.  Works like the IP, User Agent, Referrer tabs, though the code behind it is slightly more complex.  Necessitated adding a field to the "ips" db table, which means that existing IP entries will not be associated with domain names until a new visit from that address is recorded.  The way it works:  When loading the Main panels, if the domain slot is empty, an attempt is made to fill it, otherwise any previously saved value is displayed.  Clicking the "more" buttons refreshes the domain of the selected item every time.  Clicking the "more" button is one way to fill the older empty domain slots, otherwise, time and use will do the job. * In Sequential View, dropped the Renderer column and added a Domain column. * Added "Domains" graph to SomeStats page.  Currently includes Spider/Bot domains as well as all the others.  Will probably change it when I figure out how. * Added a rudimentary "Search" tab with the other tabs.  Slightly more complex coding than that behind the "Domain" tab.  Currently sends a search through the IP, Domain, User Agent, Referrer, and Requested URI tables.  Results are returned in the "Search" tab.  Can be slow if it finds many matching entries. * Moved the "Spider/Bot" and "Kill" forms to their own permanent corner (out of the "Spider/Bot - Kill" tab) and combined their functions.  Now one can add to the Spider/Bot and Kill tables simultaneously, and with any tab open.  Later added a whitelist function there as well. * Fixed a bug in Mozilla link prefetching blocker routine, thanks to a heads up from A. Dent * Added a whitelist table (named "ecstatic_aux_nolog") to the db.  It functions like the "Spider/Bot" and "Kill" tables but any entity listed in it will not be logged.  The only indication a whitelisted visitor will leave will be a "last seen" entry in the NoLog display on the Details page under the "Spider/Bot" and "Kill" table displays.  Entities that are Killed as well as WhiteListed will still be Killed, and will show in the Kill display's "last seen" slot, but their details will not be recorded.  Entities listed in the Spider/Bot table that are WhiteListed will not show up in the "last seen" slot of "Spider/Bot" table as that entry is not made concurrent with the visit.  Adding to the whitelist is done on the newly combined Spider/Bot - Kill form, making the form a triple function form! = 0.20 = * Reordered class objects, reducing memory needs, increasing speed, and promoting organization. * Added "Referrer" and "Req. URI" tabs to the Details page, and simplified some of the logic in the area. * Added working timeouts and more functionsomeness to the WhoIS routines. * The WhoIS functions now supply a link to Google Maps complete with lat/lon coordinates. * The links embedded in some User Agent strings are now clickable. * New and improved little menu button icon. * Moved rarely used table functions into external file - ecstatic_tables.php. * Made progress on the Post-title and -name mangler functions. Now, not only does ecSTATic work better with "ugly" permalinks, it works with non-ugly permalinks enabled. * Altered several tables to hold larger integer values. Added "UNSIGNED" where it hadn't been specified before. * Removed Query String Table from database. * Ported the deprecated "eregi" to "strpos", "preg_match", and "preg_match_all". * Moved more styling into ecstatic.css * Added "noprefetch" option to Options page (default is ON) to block Mozilla's link prefetching behavior, which wastes bandwidth and distorts visitor tallies, amongst other things. * Added some more help to the Help! file. * Fixed bug in URL encoding. = 0.11 = * Numerous speed/efficiency improvements. Big rewrite of the SomeStats graph routines after finding a mysql bottleneck.  Fixed another slow down that occurred when adding to or removing from the spider/kill db tables. Mo' better, now * Added an option for the number of entries listed on Details pages. * Added routines to allow upgrading from version to version without losing previous options settings. * Found WordPress functions to selectively inject .CSS and javascript files into the Wordpress header. The former should make skinning ecSTATic easier, and the former and latter have allowed the redesign of pages to utilize the vast universe of javascript. * Rendered the scoring system more useable. * Took some of the reverse IP lookup stuff out, for speed's sake. * Added two tables to the Spider/Kill tab to facilitate management of the Spider/Kill tables. Now one can see when bots and killed visitors last came by, and which ones haven't come by for some time. * Took "Update" off the main menu, and put two relevant options at bottom of Options page. == Upgrade Notice == * Because it does what you need.