Jump to content

Recommended Posts

Just wanted to know what the correct procedure is for counting page views with a site.

 

If a user visited the homepage first and then the contact us page for example, do you cound that as 1 viewing or 2 viewings?

 

Also, do I need to retrieve information about a user using the $_SERVER global to determine if it is the same user viewing the separate pages?

 

Thanks for the help.

Link to comment
https://forums.phpfreaks.com/topic/270032-page-counter/
Share on other sites

If a user visited the homepage first and then the contact us page for example, do you cound that as 1 viewing or 2 viewings?

 

It's up to you... Do you want to track a general total of page views, or a total for each page? I don't really see how much use the former would be, though. What's this data to be used for? You may be better off using Google Analytics (or an equivalent) if you just want to get some stats.

 

Also, do I need to retrieve information about a user using the $_SERVER global to determine if it is the same user viewing the separate pages?

 

Unless you only want to register views for unique users, there's no need to try to identify the user, just increment the count.

Link to comment
https://forums.phpfreaks.com/topic/270032-page-counter/#findComment-1388436
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.