| add Cookbook page
 
 
 
 
 
 
 
 | 
           Total Counter
TotalCounter v1.10.0 updateAn update to the TotalCounter tool to tidy up the report.
 This has been combined with a refactor and tidy up of the PmWiki TotalCounter and TotalCounter-Talk pages.
 This was prompted by the following issues
 a high proportion of counts being classified as "unknown"
many if not most visitors are bots[1]
use of the deprecated eregi, to make it PHP 5.5 compatiblecount by year showing many preceding years of zero
some layout problems with the report
 Upgrade cautionsThis update changes some defaults, please review the following:
 ensure you backup totalcounter.stat$TotalCounterEnableGeoIpnow defaults to 0, if you are a GEOIP user set it to 1 inconfig.php$TotalCounterLogfilenow defaults to", previously the$WorkDir/totalcounter.log"was prepended after, this makes it consistent with the other file name parameters$WorkDirBots OS, Referrer, and Location are no longer counted, to count bots add $TotalCounterCountBots =  1toconfig.phpsome of the recipe's page variables are created differently, check usage of them to ensure expected results
 Revision history 
1.10.0 - 2014-11-12 - Simon
    div with class totalcounter to allow styling; friendly names for counts; don't show LastYears of zero; add logfile; log unknowns; add more robots,
    skip unknown OS if bot; skip unknown referer if bot; skip unknown location if bot; use smaller instead of small; right align percentage; 
    $TotalCounterEnableGeoIp default to 0; enable https referers; use $FmtPVfor page variables; Add $TotalCounterEnableUsers; add OSes; use number_format ();
    add $TotalCounterCountBots Detailed explanation of changesThis update builds on the changes by 'Nigel' who updated the code from the deprecated eregitopreg_replace.
Changes are flagged with a comment in the source code. the entire report is surrounded by <div class=totalcounter>to permit CSS stylingnames for "Last day", "Last week", changed from "LastDay", etc
"Last Years" with a count of zero are not shown
text log file for developers added to trace occurrence of "Unknowns", or all visits to the website
many more robots added based on reviewing the log files of a couple of accessible sites over several weeks
"unknowns" not counted if visitor is a bot for OS, referer, or location
in report use smallerinstead ofsmall, and in general use CSSin report right align percentage columns
set the default for $TotalCounterEnableGEOIPto 0enabled HTTPS referrers
moved $countout of a loop and usedstrposinstead ofstrstrfor efficiencyTotalCounterEnableDownloadwas declared but not used, implemented ituse $FmtPVfor page variables (users of page variables should check they get the expected results)add $TotalCounterEnableUsers(default 0) to display users (requires AuthUser or UserAuth)use number_formatto add thousand delimiters to countsadd OSes: iPhone; Android
$TotalCounterEnableCountBotsdefault 0, changes TotalCounter so that unless set TotalCounter only counts Bots in the Bot chart, and does not count them for OS, Location, or Referer.
 Review or testCode reviewers or Beta testers are welcome.
 Before installing please take a backup of your totalcounter.statfile. Testing notesTesting took place over several weeks.
 monitored the php.logfile for errorsmonitored the totalcounter.logfile for unknowns, new bots, and new browserschecked report and counts visually
tested page variables below
 
      | * {$PageCount} PageCount
* {$TotalCount} TotalCount
* {$PageViews} PageViews
* {$PageCountToday} PageCountToday
* {$TotalCounterMaxItems} TotalCounterMaxItems
* Version {$TotalCounterVersion}
 |  | 6,240 PageCount
7,495,145 TotalCount
6,240 PageViews
4 PageCountToday
30 TotalCounterMaxItems
Version 2025-01-22
 |  
      | (:pagelist group=Aotearoa count=4 order=-{$PageCount} thevar="{$PageCount}" fmt=#tc-pc list=normal:)
 |  | | PageCounter | "6,240" | 
|---|
 | Aotearoa.Days | #=6,240 |  | Aotearoa.HomePage | #=6,240 |  | Aotearoa.Kiwiisms | #=6,240 |  | Aotearoa.Pages | #=6,240 | 
 |  
      | (:pagelist group=Aotearoa count=4 order=-{$TotalCount} thevar="{$TotalCount}" fmt=#tc-tc list=normal:)
 |  | | TotalCount | "7,495,145" | 
|---|
 | Aotearoa.Days | #=7,495,145 |  | Aotearoa.HomePage | #=7,495,145 |  | Aotearoa.Kiwiisms | #=7,495,145 |  | Aotearoa.Pages | #=7,495,145 | 
 |  
      | (:pagelist group=Aotearoa count=4 order=-{$PageViews} thevar={$PageViews} fmt=#tc-pv list=normal:)
 |  | | PageViews | "6,240" | 
|---|
 | Aotearoa.Days | #=7,040 |  | Aotearoa.HomePage | #=1,677,475 |  | Aotearoa.Kiwiisms | #=16,328 |  | Aotearoa.Pages | #=10,572 | 
 |  
      | (:pagelist group=Aotearoa count=4 order=-{$PageCountToday} thevar='{$PageCountToday}' fmt=#tc-pct list=normal:)
 |  | | PageCountToday | "4" | 
|---|
 | Aotearoa.Days | #=3 |  | Aotearoa.HomePage | #=377 |  | Aotearoa.Kiwiisms | #=4 |  | Aotearoa.Pages | #=5 | 
 |  
      | >>comment<<
[[#tc-pc]]
(:template first:)
||!PageCounter ||!"{$$thevar}" ||
(:template each:)
||[-{=$Group}.-]{=$Name} ||#={=$PageCount} ||
[[#tc-pcend]]
[[#tc-tc]]
(:template first:)
||!TotalCount ||!"{$$thevar}" ||
(:template each:)
||[-{=$Group}.-]{=$Name} ||#={=$TotalCount} ||
[[#tc-tcend]]
[[#tc-pv]]
(:template first:)
||!PageViews ||!"{$$thevar}" ||
(:template each:)
||[-{=$Group}.-]{=$Name} ||#={=$PageViews} ||
[[#tc-pvend]]
[[#tc-pct]]
(:template first:)
||!PageCountToday ||!"{$$thevar}" ||
(:template each:)
||[-{=$Group}.-]{=$Name} ||#={=$PageCountToday} ||
[[#tc-pctend]]
>><<
 |  |  
(:template first:)
 (:template each:)
 | {=$Group}.{=$Name} | #={=$PageCount} | 
 
 
(:template first:)
 (:template each:)
 | {=$Group}.{=$Name} | #={=$TotalCount} | 
 
 
(:template first:)
 (:template each:)
 | {=$Group}.{=$Name} | #={=$PageViews} | 
 
 
(:template first:)
 | PageCountToday | "{$$thevar}" | 
|---|
 (:template each:)
 | {=$Group}.{=$Name} | #={=$PageCountToday} | 
 
 |  |