Page 1 of 1

Hits, View and Visit.

Posted: Mon Aug 07, 2006 2:09 am
by joelloh2002
Hello,
i need help regarding WEB PAGE hits, view and visit. i'm currently doing a project that needs to calculate the home page Hits perday, view perday and visit perday. i'm very blur whats the different between hits, view and visit. Can someone help me? explain to me!

When we do programming in php, how......

1) how could we programme it to count the HITS of the website?
2) how could we programme it to count the VIEW of the website?
3) how could we programme it to count the VISIT of the website?

what kind of function that require to use? whats the fomula. Can someone please code an example for me!

Thanks in advance!
joel

Posted: Mon Aug 07, 2006 2:22 am
by RobertGonzalez
Google is your friend...

Found this site explaining the difference between hits, views and visits.

As for coding something that can do this, it might be a bit unreliable, but there are web site stat apps out there that you could learn from. You would essentially need to use cookies, possibly IP's and a database to monitor who is coming to your site, from where they are coming and how often (also keeping track of unique views in addition to total traffic).

Posted: Mon Aug 07, 2006 4:29 am
by s.dot
Hrmm, a toughy.

Either way, you're not going to get truely accurate data. If you use cookies... some people disable them. If you go by IP, some people have dynamic IPs, use a dynamic web proxy, or even the AOL browser.

Some coding examples...

Cookies:

Code: Select all

if(isset($_COOKIE['beenHere'])){
   // user has been here before
} else {
   // new user
   setcookie("beenHere",1,time()+60*60);   // one hour cookie
}
IPs

Code: Select all

$ip = $_SERVER['REMOTE_ADDR'];  // most genericly
//query for ip in a database
if($foundip){
   //returning user
} else {
   //new user
}
Perhaps you could combine them. You're also going to need a backend database to do the storing and come up with any useful data presentation.