How to count the number of page view

I have seen the question Better way to count total page views?

I think, the better way is.. We can save the number of page views in the database. It is acceptable. But, it is not fulfilling my requirement, if many different users can appear to have the same IP Address (e.g, if they are coming from a Large organization). How to re-design the table to suit for this scenario.

Can anyone help me to design the table with sample data.

asked Oct 25, 2013 by Vinayagam R S (190 points)

1 Answer

A brief idea:

For each page, there is a counter. For each user, identify them by an ID (session ID?) in the cookie.

Along with each counter, record the user IDs with time stamps in the last a period of time (say, 30 mins). Each time a counter/page is hit, first check the user ID lists, delete those with timestamps older than 30 mins. Then check whether the current user ID for this hit is in the user ID list. If it exists, do nothing. If it does not exist, increase the counter and add the current user ID with the current timestamp to the user ID list for this counter.

answered Mar 5, 2014 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost