Mobile app version of vmapp.org
Login or Join
Cooney921

: Handling Page View for Images Site I want to know how sites like stackoverflow.com or imgur.com manage the page views of their article. i.e. once i view it and then no matter how many times

@Cooney921

Posted in: #Analytics #Statistics

I want to know how sites like stackoverflow.com or imgur.com manage the page views of their article.
i.e. once i view it and then no matter how many times i refresh it.. the page view count won't increase.
I would also like to implement it for my image site and would also like to know when should i update views in database.

Thanks.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Cooney921

2 Comments

Sorted by latest first Latest Oldest Best

 

@Cofer257

Here's how I would do it:


First check that it looks like a real person using a browser and not a search engine bot (e.g. check the user agent string for "bot").
Store the IP address in a database with each visited page, for up to 24 hours.
On each page load, if this IP address has not viewed this page in the last 24 hours then add 1 to the view count.

10% popularity Vote Up Vote Down


 

@Martha676

This is normally handled using session variables. When the user enters the site for the first time, a session is created.

Every time you view view an article or a page, the site checks whether the id of the page is stored in the session variable. If it isn't, then the view is counted and the id stored in the session variable. Otherwise, the view count is skipped.

The way you implement this feature depends on the programming language you used to create your site (Ruby, Python, Java, PHP...).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme