Dlstats
From Contao Community Documentation
I'm not a native English speaker. Please correct my mistakes.
Counts the number of file downloads
- Download statistics for the standard content elements Download and Downloads
- Count number of downloads per file plus latest download timestamp
- Optionally log every single download with timestamp, IP and username.
- Insert-Tag for number of downloads in the frontend (from 2.1.0)
- Ignore certain IPs (define itself, from 2.1.0)
Extension-Overview | |
---|---|
Name of the developer | Glen Langer (BugBuster) |
Developer Website | http://contao.glen-langer.de |
Version of the extension | 2.1.0 rc1 |
Compatibility with Contao Version | from 2.9 |
Compatibility with TYPOlight Version | 2.7.6 - 2.8.4 |
Link to Extension Repository | http://www.contao.org/extension-list/view/dlstats.en.html |
Link to Tracker | https://github.com/BugBuster1701/dlstats/issues |
Depending of ff. Extension | Bot Detection |
Installation
The installation of the module occurs about the extension Repository in back end of Contao. On manual installation, call /contao/install.php - Perform Update Database.
For manual installation, please note that the module "Bot Detection" must be installed.
Using
Go to the Contao Settings and switch on the logging, either only counting the number of downloads per file, or optionally also log each download with timestamp and IP.
In the settings you can be deactivated the Anonymize IP function, it must be the admin.
Use the content element File Download or File Downloads for all downloaded files you want to have counted.
After downloading a file you will find the statistics under Content - Download Stats.
Using Insert-Tag
The Insert-Tag "cache_dlstats::total downloads::..." supports both, the source of the file (relative path + file name), as well as in connection with the article alias and how it generates for ce_download and ce_downloads. Therefore, the use is well used in the templates of the two CEs, see examples. Return is only the number of downloads as a number.
{{cache_dlstats::totaldownloads::tl_files/cdc2010.pdf}} {{cache_dlstats::totaldownloads::CDC_2010.html?file=tl_files/cdc2010.pdf}} // in ce_download template: {{cache_dlstats::totaldownloads::<?php echo $this->href; ?>}} // in ce_downloads template: {{cache_dlstats::totaldownloads::<?php echo $file['href']; ?>}}
Ignore certain IPs
If any downloads from certain IP addresses should not be counted, this can be defined in the localconfig.php as follows:
$GLOBALS['DLSTATS']['BOT_IPV4'][] = '192.168.1.2'; $GLOBALS['DLSTATS']['BOT_IPV4'][] = '192.168.0.0/24'; //respectively $GLOBALS['DLSTATS']['BOT_IPV6'][] = '2001:0db8::1'; $GLOBALS['DLSTATS']['BOT_IPV6'][] = '2001:0db8:85a3:0800::/56';
Notice
- Simple links to files will not be counted as downloads!
- If you are logged in the backend, your download is not counted. (from 2.1.0)
--BugBuster 00:10, 29 December 2011 (CET)