PDA

View Full Version : page visiting code



somakumaran@gmail.com
07-09-2012, 12:48 PM
Hi
I am making a web site that www.ask-photos.com with some script using from this site . I want to create a digital page visit counting each month or total

Please help me :rolleyes::(
by Somakumaran

ApacheTech
07-09-2012, 02:14 PM
Make an account with Google Analytics:

www.google.com/analytics/

Link that account to SeeTheStats:

http://www.seethestats.com/

Follow guide to put it all together:

http://www.labnol.org/internet/display-google-analytics-stats-on-website/17707/

GA is a very good way to optimise your traffic flow, the data it collects is surprisingly detailed. With SeeTheStats, you can then make that information public and share it on your site.

bernie1227
07-10-2012, 12:17 AM
Or if you want to go very low tech, you could use a very simple PHP hit counter and in each page you want to use it, all you have to do is reference it using include:


<?php
include ("counter.php");
?>

so the code within counter.php, will be:


<?php
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo $hits[0];
?>

ApacheTech
07-10-2012, 12:49 AM
Another low-tech method is to use a CGI script. You can make a decent hit-counter at http://www.digits.com They walk you through it step by step (There's only five steps or so) and then just copy-paste to code they give where you want it to be displayed.

bernie1227
07-10-2012, 03:06 AM
Just as a side note, are you trying to count the hits for inividual users? Or for all the hits to the site? The only reason I ask is because this thread is in the javascript forum.