A download counter not only provides you useful metrics but also gives your visitors a hint about the most popular files.
If you offer your visitors files to download you may want to count how many times each file is download. I use CCounter, a PHP Click Counter to count the number of times my books have been read. It’s so simple but yet it does everything you need. It’s currently on version 2.0 and its user interface looks a lot better than the original – and the installation is easier too. This “plugin” transforms your files’ URL into a special URL. When a visitor opens that special URL, CCounter counts a view and then redirects the file’s real location. Afterwards, using PHP, you can display the number of types that file was downloaded or viewed.
- Download CCounter 2.0 from the official website at phpjunkyard.com. Unzip the file to a folder named, for example,
- Upload the folder to your website via FTP or similar. I used Filezilla and uploaded the folder to
- Use your browser to open the folder you just uploaded. In the example, go to
- Follow the installation steps that appear. Don’t forget to delete the folder named
To set up a counter for a specific file:
- Upload your file to your website and copy the url, for example:
- Go to CCounter’s admin console by visiting its main folder on the browser. Following the example, open the URL
- Open the New link page and submit your chosen link as a new link. Paste the URL of your file.
- After the URL is submitted, a special tracking URL is generated by CCount, for example
Every time you want to provide a link to your file (
<a href="...">) use the URL generated by CCount (e.g.
www.your-domain.com/ccount/click.php?id=123). When a visitor clicks that URL, CCount will count the click and redirect the visitor to where the real file is (e.g.
To show the number of clicks or downloads of a file you need to:
- Place the following code inside the
<head>tag of the webpage where you want to display count statistics:
- Paste the next snippet exactly where you want the count to appear:
Simple, but effective!