DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: Pagehits¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed by: | Armin Rüdiger Vieweg |
Changed: | 2011-03-29T00:23:59.480000000 |
Classification: | pagehits |
Keywords: | pagehits, pages, hits |
Author: | Armin Ruediger Vieweg |
Email: | info@professorweb.de |
Info 4: | |
Language: | en |
EXT: Pagehits - pagehits
EXT: Pagehits¶
Extension Key: pagehits
Language: en
Keywords: pagehits, pages, hits
Copyright 2000-2011, Armin Ruediger Vieweg, <info@professorweb.de>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.or g
Table of Contents¶
`Introduction 3 <#__RefHeading__143836_1880895096>`_
`Administration 4 <#__RefHeading__47286_349685753>`_
`Configuration 5 <#__RefHeading__47294_349685753>`_
Output the pagehits of current page 5
`Known problems 6 <#__RefHeading__748_1253375793>`_
Introduction¶
What does it do?¶
The pagehits extension extends the pages table with a new column which contains the number of visitors' hits on this page. To prevent imprecisions, counted pages are stored in the visitor's session and will be counted once for each session/user. This can be disabled in the setup.
Usage¶
You can use the stored pagehits value to:
show it on the current page
use it to order pages by its popularity (in typoscript or in your own extension)
Administration¶
Requirements¶
The pagehits extension has no known requirements, except TYPO3 of course.
Installations¶
You can fetch the pagehits extension like every extension from the TER (TYPO3 Extension Repository), which has been integrated very elegant, since TYPO3 4.5.
In installation progress you'll have to confirm the add of new column to pages table.
If the installation has been successful, you should add the static template to your TYPO3-Template:
Libs of pagehits are available now, but to count pagehits you'll have to integrate the libraries to your page, as explained in the configuration chapter .
For developers¶
If you are developer, you may checkout the latest version of pagehits out of the TYPO3 SVN. You do this, on your own risk. Versions which has been uploaded to TER are tested and should work as expected.
SVN Link of pagehits extension: https://svn.typo3.org/TYPO3v4/Extensions/pagehits/trunk/
Configuration¶
Enable count of pagehits¶
To enable the count of pagehits, you'll have to add the pagehits library anywhere in typoscript, like in the following example:
page = PAGE
page {
typeNum = 0
5 < lib.pagehits
10 < styles.content.get
}
You can use typoscript conditions for example:
to disable count of pagehits for logged in users
exclude specified IP addresses from logging
Output the pagehits of current page¶
To show the pagehits of current page on the page itself, you can use the lib.showPagehits:
pagehits = COA
pagehits.10 < lib.showPagehits
pagehits.wrap = <h2>\|</h2>
Property of lib.pagehits¶
lib.pagehits.userFunc.filterBySession¶
Key
lib.pagehits.userFunc.filterBySession
Data type
boolean
Default
1
Description
If set to 1 the pages which have been counted by each visitor are stored in the visitor's session. If the visitor refreshs or revisits the page again, this will be NOT counted. You can disable with the value 0. Then every pageimpression will be counted.
Example¶
The following example shows the full setup in static template:
includeLibs.user\_Pagehits =
EXT:pagehits/Classes/class.userPagehits.php
lib.pagehits = USER\_INT
lib.pagehits {
userFunc = user\_Pagehits->addHits
userFunc {
filterBySession = 1
}
}
lib.showPagehits = USER\_INT
lib.showPagehits {
userFunc = user\_Pagehits->showHits
}
Known problems¶
lib.showPagehits shows pagehits before it counts¶
If lib.showPagehits is included to typoscript before lib.pagehits the user get the current pagehits without including his hit. In that case you show the pagehits first and after that you'll increase them by one.
You can pass this problem, if you insert the lib.pagehits before the contents of page, like in the first example of confguration chapter .
6