|
Cookbook /
TotalCounterSummary: A statistic counter - counts page views, users, languages, browsers, operating systems, referers, locations and web bots
Version: 2008-01-22 - v1.9.1
Prerequisites:
Status:
Maintainer: Blues
Discussion: TotalCounter-Talk
Question(s)
AnswerDownload unofficial version 1.9.1: totalcounter_1_9_1.phpΔ (see changelog, old official version 1.5. is still available: totalcounter.phpΔ ). Version 1.9 brings new time statistics (visits over last day, last month, etc.) on top of the features found in 1.8a I found that migrating from the 1.5 version to 1.8a that I lost all of my prior total counts. I saw no mention nor documentation that the files where the counts are persisted to was renamed. I found that to retain the prior version total counts you can do one of two things:
Here are the file names for the different versions:
IchBin Profiles May 15, 2007, at 11:48 AM Hmm; shouldn't the file names still start with a dot (in future versions of TC)? currently, when searching all pages (?action=search&q=/), a non-existent page named 'totalcounter.stat' is displayed because of the lack of the dot. Optionally, the filenames could be set using some configuration variables. MateuszCzaplinski October 02, 2007, at 02:13 PM
It is a simplified statistics counter which counts a variety of informations such as page views, users browsing, languages used, browsers used by visitors, languages, operating systems used by visitors, referers from which the visitors come from, locations from where the visitors come from and web bots that index the pages. It does not log single visits but just keeps the total count. NotesInstallationDownload the script from above and place it in your cookbook directory. Then add include_once('cookbook/totalcounter.php'); in your local configuration (local/config.php).
Configuration:If you personalize $DefaultGroup and $DefaultName they must be set to the desired value before including the TotalCounter script (see notes below).
You may give a value to the following variables before including the script (e.g. $TotalCounterAuthLevel) to configure some aspects of the TotalCounter:
$TotalCounterAction can be used to change the action for the statistics page (default is 'totalcounter').ex. $TotalCounterAction = 'totalcounter';
$TotalCounterAuthLevel can be used to change the authorization level necessary to see the statistics page (default is 'read').ex. $TotalCounterAuthLevel = 'admin';
$TotalCounterMaxItems can be used to set the maximum items to be displayed under each section of the statistics page (default is 20).ex. $TotalCounterMaxItems = 10;
$TotalCounterEnableLookup can be used to enable the DNS lookup to retrieve the user's location in case the server doesn't do it automatically (default is 0, disabled). Please note that DNS lookup may be a time consuming task.ex. $TotalCounterEnableLookup = 1;
$TotalCounterBlacklist is an array (of arrays) that can be used to blacklist some items from being logged (the default blacklist is empty).
The available arrays are as follows:
$TotalCounterBlacklist['Pages'], $TotalCounterBlacklist['Users'],
$TotalCounterBlacklist['Browsers'], $TotalCounterBlacklist['OSes'],
$TotalCounterBlacklist['Referers'], $TotalCounterBlacklist['Locations'],
$TotalCounterBlacklist['Bots'], $TotalCounterBlacklist['Languages']
Regular expressions can be used for page names, users and referers, ex
$TotalCounterBlacklist['Pages'] = array('Main.HomePage','/^Site\..*/');
$TotalCounterBlacklist['Users'] = array('Admin','Paul','/^Author.*/');
$TotalCounterBlacklist['Referers'] = array('localhost');
$TotalCounterBlacklist['Locations'] = array('localhost');
$TotalCounterBarColor can be used to personalize the color of the bars in the statistics page. It is a string with the CSS syntax for color (default is '#5af').ex. $TotalCounterBarColor = '#000';$TotalCounterBarColor = '#3fca3f';
$TotalCounterShowNumbers is used to show or hide the numbers next to the items in the statistics page (default is 1, enabled).
New in 1.8: $TotalCounterDownloadManager is used to show all the download counts if you have the DownloadManager cookbook recipe installed. This contains the filename of your download manager stats file.
$TotalCounterGeoIP contains the filename for MaxMind's . This provides more accurate information on where visitors are located, and must be placed in the Wiki.d directory.
$TotalCounterEnableGeoIP set this to 1 to enable GEOIP database lookups, and set $TotalCounterEnableLookup to 0 so that the GEOIP is used, otherwise it defaults to normal behavior for trying to identify the country.
New in 1.9: $TotalCounterEnableChmods (default: 1). Set this to 0 if your server doesn't allow PHP chmod() function to be run.
(Please see here about integrating GoogleCharts http://pmichaud.com/pipermail/pmwiki-users/2008-January/048443.html (Division by zero if there isn't any visit to some page. Tested in version 1.5) Tasos Use:After the installation the variables {$TotalCount} and {$PageCount} can be used in the markup to display respectively the total pages visited and the current page views ($TotalCount and $PageCount can be used in a skin .tmpl file in PmWiki versions before 2.1).$PageCount is the same that is used by the SimplePageCounter, so an upgrade to TotalCounter is possible without changing the markup (but will lose old counts). This also means that the two recipes cannot be used together (why to do it anyway?).
A new page variable is available, {$PageViews}, which can be used as a normal page variable. For example {MyPage$PageViews} gives the page views of the page MyPage.
Can also be used in pagelist templates.
A new action can be used to display a statistics summary page, just add ?action=totalcounter to the url to see the statistics.
![]() i18n:The following strings are used and can be internationalized (i18n).
Notes:A single text file is saved in the wiki.d directory with the name .total.counter in which the informations are stored. Since the directory already has write permissions, no configuration is needed.
A page view is counted only when action=browse.
When $pagename is empty ('') the recipe counts a hit to the default page , so if you want to change them in your local configuration config.php file, they must be set to the desired value before including the totalcounter.php.
For users statistic count to work a user authentication recipe (UserAuth or AuthUser) must be installed.
For languages statistic count to work the MultiLanguage recipe must be installed.
The .total.counter file format is as follows:
Example:
a:2:{s:5:"Total";i:3406;s:5:"Pages";a:2:{s:13:"Main.HomePage";i:1412;s:9:"Main.Test";i:213;}}
Means:
array(
"Total"=>3406,
"Pages"=>array(
"Main.HomePage"=>1412,
"Main.Test"=>213
)
);
Examples:You can see the recipe live here, on the bottom left corner the page/total views are displayed (add ?action=totalcounter to the url to see the statistics page).
Releases
See Also
See the recipe live here, on the bottom left corner the page/total views are displayed (add Contributors
|