PDA

View Full Version : Best Script to Count Clicks (Uniques)



MATRIX
July 8th, 2003, 15:14
Do you know any? :D ... if you have tested one plz tell me , if you can post the Link :p

Sodfather
July 9th, 2003, 22:30
If you have PHP, I'd recommend this for unique user counting:

<?
$filename="visitors.txt";

$file=file($filename);
$file=array_unique($file);
$hits=count($file);
echo $hits;

$fd=fopen($filename,"r");
$fstring=fread($fd,filesize($filename));
fclose($fd);
$fd=fopen($filename,"w");
$fcounted=$fstring."\n".getenv("REMOTE_ADDR");
$fout=fwrite($fd,$fcounted);
fclose($fd);
?>
What it will do is obtain the visitor's IP and check if it has been written to visitors.txt yet. If it has, the script will not add to the unique visitors count; if not, it will add the IP to the list so that it will not be counted in the future and it will add to the unique visitors count.

Make sure you create the visitors.txt file and CHMOD it to 777.

Edit: Just read your sig. How 'bout...Esta cosa es solmente para personas muy intelligentes. :D That should make sense if Spanish I taught me anything. :D

Second Edit: Crap. Just noticed the title is "clicks". Mine is used for hits. Sorry. :(

MTG
July 10th, 2003, 05:03
I think Fast Click (http://www.ftrain.hotbox.ru/fclick.html) is one of the best scripts! ;)