Hits, View and Visit.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
joelloh2002
Forum Newbie
Posts: 4
Joined: Mon Aug 07, 2006 1:59 am

Hits, View and Visit.

Post 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
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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).
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply