So basically I want to implement the same functionality as StackOverflow's:
viewed 59344 times
So here is some background information:
- I want to count only unique visits. The assumption that registered users will read the article many times (it is evolving)
- I use MongoDB as a store
- I would like it to be close to real-time
- My system will have a registration, but I want to count the views of anonymous users as well
I understand that the best way to count unique visits is through registration, but the thing is that a big chunk of users will be just passive readers who do not need to create an account to read the information from the application. As far as I understand, the most convenient way is to save the IP address of every user, who reads the post. I also understand that IP addresses will not provide uniqueness (some different users will have the same IP, because they are behind the same ISP and one user can have different IPs, by using proxies, tor, etc)
The use of Mongo is not absolutely essential, just the thing is that everything is written in Mongo right now, so I will switch only if it will be much faster/convenient.