Logic for number of person viewed
I want to show the number of viewer for a particular Article. Ho开发者_运维百科w i will do it in my program? Any strategy, someone can suggest ...
If you aren't using any framework or CMS, then you can integrate either Google Analytics or Piwik into your website. Then use their inner data to display number of views/unique views per article.
- Make a table with article id/url (or whatever you technique is), IP, user agent.
- In every relevant page have each page access write down these values.
- To display number of views simply select count
- To display number of unique views display count(distinct)
精彩评论