问题
My Rails app creates a handful of very simple "landing pages" and I'd like to know when a visitor comes to the web page with a "view counter."
Are there a recommended gem, plugin, or maybe some code someone can send to me to help me?
Thank you.
回答1:
Try this plugin .. https://github.com/iorum-ie/acts_as_viewable
It actually checks IP address so visits from the same IP won't be recounted within a period of time.
回答2:
RailsStats should be compatible with 2.3.x
回答3:
I would suggest with redis. It's perfect for realtime stats. It gives you the speed and atomic increments that you want, plus it persists.
If you dont want to rely on external things then try this link.
simple hit counter for page views in rails
来源:https://stackoverflow.com/questions/5295026/is-there-a-super-simple-way-to-record-report-page-views-in-rails-2-3-x