PHP Classes

PHP Click Counter Database: Generate links and keep track of clicks on them

Recommend this page to a friend!
  Info   View files Example   View files View files (1)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 68%Total: 358 All time: 6,908 This week: 125Up
Version License PHP version Categories
click-counter 1.0MIT/X Consortium ...5.0HTML, PHP 5, User Management
Description 

Author

This class can generate links and keep track of clicks on them.

It can take the URL of a given link and returns another URL that will be used to keep track of the clicks on that link.

The link points to a script that will be used to record the clicks on a database accessed via PDO, and then it redirects the browser to the original link.

Alternatively the class can also store the clicked links of text files.

The database connection string, the URL for invalid links, the destination link base URL, the file for storing click counts are some of the configurable parameters.

Recommendations

Looking for good pluggable click tracker mechanism
Would like to track how many times various buttons are clicked

Picture of Ettore Moretti
  Performance   Level  
Name: Ettore Moretti is available for providing paid consulting. Contact Ettore Moretti .
Classes: 12 packages by
Country: Italy Italy
Age: ???
All time rank: 107841 in Italy Italy
Week rank: 76 Up3 in Italy Italy Up
Innovation award
Innovation award
Nominee: 3x

Example

<?php
require_once 'core/CCounter.class.php';
$CC=new CCounter();
?>
<html>
<head>
<title>Click Counter Example</title>
</head>

<body>

<h1>Click Counter PHP - Example use</h1>
<p>Click a link to increase the relative counter.</p>

<a href="<?php print_r($CC::getHref('link1.html')); ?>" target="_blank">Link1</a><br/>
<a href="<?php print_r($CC::getHref('link2.html')); ?>" target="_blank">Link2</a><br/>
<a href="<?php print_r($CC::getHref('link3.html')); ?>" target="_blank">Link3</a><br/>
<a href="<?php print_r($CC::getHref('link4.html')); ?>" target="_blank">Link4</a><br/>
<a href="<?php print_r($CC::getHref('link5.html')); ?>" target="_blank">Link5</a> (404 page, link broken example)
</body>
</html>


  Files folder image Files  
File Role Description
Accessible without login Plain text file index.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:358
This week:0
All time:6,908
This week:125Up
User Ratings User Comments (1)
 All time
Utility:83%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:83%StarStarStarStarStar
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:68%StarStarStarStar
Rank:563
 
This is a very good and useful class ;-)
7 years ago (Josť Filipe Lopes Santos)
80%StarStarStarStarStar