E-Xoops i-Stats module.
Index
Brief Description Description Features Usage Installation FAQ Change Log Upgrade Info Version Notes Author Copyright License
Brief Description
E-Xoops i-Stats module. Top
Description
Records anonymous data as supplied by the users browser (via javascript). It displays details of the usual stats plus: the pages served users browser users OS users screen size users colour depth lists (with count) referers etc. As of version 1.01 i-Stats can be used as a graphical counter. As of version 1.02 there is a block for displaying stats. Top
Features
Displays Top 50 page requests Keeps total count of pages served, including refreshes and revisits Keeps a count of visitors per day Keeps a count of total visitors Keeps track of users hostnames Keeps track of referers Keeps a count of visitors per week Keeps track of users browser Keeps track of users OS Keeps track of visitors per hour (accumulative) Keeps track of visitors per hour (daily) Keeps track of visitors per hour (weekly) Keeps track of visitors per hour (monthly) Keeps track of visitors per month Keeps track of visitors screen size ie 800x600 Keeps track of visitors screen colour depth Displays Top 30 Referers Can be used as a graphical counter. Block for showing stats. Top
Usage
i-Stats as a counter To use i-Stats as a counter, add the following two lines to your themes.php file(s): `` include_once(XOOPS_ROOT_PATH . '/modules/istats/include/function.php'); $result = CountDays(); This gives access to the following figures: $result['days'] The number of days that stats are available for $result['total'] The total number of visitors $result['ava_day'] The average number of visitors per day $result['ava_hour'] The average number of visitors per hour $result['ava_week'] The average number of visitors per week $result['ava_mth'] The average number of visitors per month $result['max_date'] The busiest day $result['max_daycount'] The number of visits on the busiest day $result['today'] The number of visitors so far today $result['this_week'] The number of visitors so far this week $result['this_mth'] The number of visitors so far this month $result['max_week'] The busiest week, as year # week number "2003 # 47" $result['max_weekcount'] The number of visitors in the busiest week $result['max_mth'] The busiest month $result['max_mthcount'] The number of visitors in the busiest month $result['totalpages'] The total number of pages served For example: `` There have been <?php echo $result['total']; ?> visitors in the last <?php echo $result['days']; ?> days. produces something like: There have been 9876 visitors in the last 100 days Or you could use CSS to create a different effect, for example, the following: `` ?> <span style="font-family: courier; color: white; background: #336699"> <?php echo $result['totalpages']; ?></span> pages served to <span style="font-family: courier; color: white; background: #336699"> <?php echo $result['total']; ?></span> visitors <?php produces something like: 009876 pages served to 005678 visitors Display numbers as images To display the above numbers as graphics add these two lines in addition to the two above: `` $graphics = num_to_graphics($result['total'], 8, XOOPS_URL . '/modules/istats/images/default','jpg'); echo $graphics; The first parameter is the number to convert. The second parameter is the number of digits (includes leading zeros). The third parameter is the path to the image files. The fourth parameter is the file extension of the images, e.g. jpg, gif etc. Example graphical counter Inserted into theme.php function themefooter: `` include_once(XOOPS_ROOT_PATH . '/modules/istats/include/function.php'); include_once(XOOPS_ROOT_PATH . '/modules/istats/include/display.php'); $result = CountDays(); $graphics = num_to_graphics($result['total'], 8, XOOPS_URL . '/modules/istats/images/default','jpg'); echo $graphics; or `` include_once(XOOPS_ROOT_PATH . '/modules/istats/include/function.php'); include_once(XOOPS_ROOT_PATH . '/modules/istats/include/display.php'); $result = CountDays(); $graphics = num_to_graphics($result['totalpages'], 8, XOOPS_URL . '/modules/istats/images/default','jpg'); echo "<div align=\"center\"> $graphics </div>"; or `` include_once(XOOPS_ROOT_PATH . '/modules/istats/include/function.php'); include_once(XOOPS_ROOT_PATH . '/modules/istats/include/display.php'); $result = CountDays(); $pages = num_to_graphics($result['totalpages'], 8, XOOPS_URL . '/modules/istats/images/default','jpg'); $visitors = num_to_graphics($result['total'], 8, XOOPS_URL . '/modules/istats/images/default','jpg'); echo "<div align=\"center\"> $pages pages served to $visitors visitors </div>"; Top
Installation
Upload all files to a directory called exoops/modules/istats on your server. Run E-Xoops admin, and install 'Web Stats' module. Give access to groups as required. Add the following code to the footer (Admin, Meta Generator, Footer Settings) [ still effective even if theme changed ;-) ] `` <!-- Add to footer --> <script type="text/Javascript"> <!-- istat = new Image(1,1); istat.src = "http://yourdomian.com/exoops/modules/istats/counter.php?sw="+screen.width+"&sc="+screen.colorDepth+"&refer="+escape(document.referrer)+"&page="+location.href; // --> </script> <!-- end --> Do not put a line break in the istat.src line!! And don't forget to change 'yourdomain.com' to your sites domain. Top
FAQ
Q. How do I change the graphic numbers? A. Change the third parameter in the line '$graphics = num_to_graphics' to the directory that contains the images you want to display. Q. Why did you choose to use i-Stats A. For several reasons, * It was written in English, making it easy for me to understand, * It is well written, both syntactically and logically, * Uses database accesses economically, * Is designed in a way that does not get bogged down with historical data. Q. How do I change the contents of the block? A. Comment out the lines in 'blocks/istats_blocks.php' that you dont want to display. Top
Change Log
v1.03 Renamed image folders to more accurately describe their contents. v1.03 Improved browser detection v1.03 Hopefully corrected problem with path names in v1.02 zip file. v1.03 Added black on white graphics for numbers, courtesy of TheBeastMaster v1.02 Total pages served can be displayed in counter. v1.02 Improved browser detection. v1.02 Improved OS detection v1.02 Fixed problem with truncated referer URL's (change to Installation). v1.02 Changed to work with exoops, now uses exoops cookie v1.02 Added more OS's v1.02 Added more Browsers v1.02 Added block for displaying stats v1.01 Added display.php to allow i-Stats to be used as a graphical counter v1.01 Added $myts functions to clean up referer url?querystring Top
Upgrade Info
v1.01 to v1.02 Upload the files to your server. From E-Xoops Admin update module 'Web Stats'. v1.02 to v1.03 Upload the files to your server. Top
Version
Version 1.03 Top
Notes
Only keeps stats (except total of page) for unique visitors, where a unique visitor is defined by the lifetime of the cookie. This module is based on: PHP i-Stats Version 1.5 Developed By Sam Tang (sam@hkscript.com) License : GNU Public License (GPL) Homepage : http://hkscript.com Top
Author
Paul Cooke http://paul-cooke.com Top
Copyright
Copyright (c) 2003 Paul Cooke Top
License
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Top
E-Xoops i-Stats module.