Hi friends,
Lots of you asked about how to make real time site analytics,
Sorry I have no idea about that on ASP.Net but can help you with PHP !
The code for you !
Get page hits and store it into a text file, you can then show or hide analytics
$file="counter.txt";
// Reading file if exist
// Delet file to reset counter
$cpt = 1;
if(file_exists($file)) {
$inF = fopen($file,"r");
$cpt = intval(trim(fgets($inF, 4096))) + 1;
fclose($inF);
}
// Saving hits
$inF = fopen($file,"w");
fputs($inF,$cpt."\n");
fclose($inF);
?>
Add this to show hits on your site
And online visitors ?
Place it wherever you like !
$Fnm = "online.txt";
$IP=$REMOTE_ADDR;
$date0 = time()/60;
$vie = 5;
if (file_exists($Fnm)) {
$inF = fopen($Fnm,"r");
while (!feof($inF)) {
$ligne=fgets($inF, 4096);
$temp = explode("",$ligne);
if($temp[0]!=$IP) {
if($date0-intVal($temp[1])<=$vie) { $online++; $result .= $ligne . "\n"; } } } fclose($inF); } $result .= $IP . "" . $date0 . "\n"; $online++; // Et on sauve $inF = fopen($Fnm,"w"); fputs($inF,$result); fclose($inF); ?>
and then and online visitors will be showen on your sites !
Hope this interests lot of you game coders ;)
I forget that lots of you are lazy so I'll suggest this site (also if your server doesn't support PHP) : www.feedjit.com
I use both PHP and feedjit on www.barcodemaker.uni.cc
Hope you like it.
If you need pro and high startics why not try Google !
www.google.com/analytics
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment