页面浏览量和点击量
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.
我认为,更好的方法是..我们可以在数据库中保存页面浏览量。 它是可以接受的。 但是,如果许多不同的用户似乎具有相同的IP地址(例如,如果它们来自大型组织),那将不能满足我的要求。 如何重新设计表格以适合这种情况。
Can anyone help me to design the table with sample data.
谁能帮我设计带有样本数据的表。
A brief idea:
一个简短的想法:
For each page, there is a counter. For each user, identify them by an ID (session ID?) in the cookie.
每页都有一个计数器。 对于每个用户,请通过Cookie中的ID(会话ID?)来标识他们。
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.
与每个计数器一起,记录最近一段时间(例如30分钟)中带有时间戳的用户ID。 每次点击计数器/页面时,请先检查用户ID列表,然后删除时间戳早于30分钟的用户ID。 然后检查此匹配的当前用户ID是否在用户ID列表中。 如果存在,则什么也不做。 如果不存在,请增加计数器,然后将具有当前时间戳记的当前用户ID添加到该计数器的用户ID列表中。
翻译自: https://www.systutorials.com/how-to-count-the-number-of-page-view/
页面浏览量和点击量