I’m going to create a view counter for articles. I have some questions:
-
Should I ignore article’s author
when he opens the article? -
I don’t want to update database each
time. I can store in a
Dictionary<int, int>(articleId, viewCount) how many times
each article was viewed. After 100
hits I can update the database. -
I should only count the hit once per
hour for each user and article. (if
the user opens one article many
times during one hour the view count
should be incremented only once).
For each question I want to know your suggestions how to do it right.
I’m especially interested how to do #3. Should I store the time when the user opened the article in a cookie? Does it mean that I should create a new cookie for each page?
I think I know the answer – they are analyzing the IIS log as Ope suggested.
Hidden image src is set to
[Random code] is needed because many people may share the same IP (in a network, for example) and the code is used to distinguish users.