[TYPO3-dev] Nice page counter

R. van Twisk typo3 at rvt.dds.nl
Tue Jan 9 02:10:49 CET 2007


John Angel wrote:
> Hi,
>
> I was looking for ext which makes nice page counter, which can be used for
> "Most popular pages" feature.
>
> System solution is using sys_stat extension. It does raw logging into
> sys_stat table an the problem is that it becomes really huge soon. Thus it
> doesn't provide aggregate information right away, but it requires time
> consuming queries to get necessary data.
>
> Actually, small table with one record per page id is enough, having
> aggregated information how many views each page had.
>
> I suppose it should be made with sys_stat-PreProcClass hook doing counting
> of page views, instead of making raw inserts as sys_stat ext does.
>
> Since sys_stat-PreProcClass hook works when sys_stat is installed only, to
> avoid raw logging it is necessary to hack class.tslib_fe.php, to comment out
> the line:
>
> $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_stat', $insertFields);
>
> Not so nice solution.
>
> Another solution is post processing sys_stat table raw logs, every hour
> using cron job, counting page views and updating another table with it.
>
> Any ideas about the whole thing? The performance is the number one priority,
> it should be the fastest solution.
>
> Many thanks,
> John
>
> _______________________________________________
>   
Hi John,

you cam properly hook this 
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output'][] 
= ...


contentPostProc-output get's called only once for each page.
I remember you an find the page ID 'somewhere' and from there update your
popular pages table.

Possible you want to add a couple of settings to not count pages from IP 
addresses
so you will not count your own browsing and editing on your site.

After that you can add counters to count pages by country :) and a 
couple of more cool stuff....

Anyways, the above hook might help you out so you don't need to install 
sys_stat.

Ries

-- 
Ries van Twisk
Freelance Typo3 Developer
=== Private:
email: ries at vantwisk.nl
web:   http://www.rvantwisk.nl/freelance-typo3.html
skype: callto://r.vantwisk






More information about the TYPO3-dev mailing list