Hello all, Yet another "don''t reinvent the wheel" n00b question: Is there an ''official'' page hit counter plugin/code snippet/whatever? I would need something like this: - It is possibility to set a constant timespan (say 5 hours). - On every page hit, save away @request.remote_ip and Time.new - The counter gets incremented only if the same IP was here longer ago than the constant Of course this is trivial to do, but just in case there is something like this, LMK (i have been googling for it but did not find anything relevant - how should i look for such stuff in the future?) TIA, Peter
Peter Szinek <peter@rubyrailways.com> writes:> Hello all, > > Yet another "don''t reinvent the wheel" n00b question: > > Is there an ''official'' page hit counter plugin/code snippet/whatever?I don''t think so. But there are many commercial as well as free ones out there. I will recommend Statcounter www.statcounter.com (google if link fails). Put the code in you layout files.> I would need something like this: > > - It is possibility to set a constant timespan (say 5 hours). > - On every page hit, save away @request.remote_ip and Time.new > - The counter gets incremented only if the same IP was here longer ago > than the constant > > Of course this is trivial to do, but just in case there is something > like this, LMK (i have been googling for it but did not find anything > relevant - how should i look for such stuff in the future?) >HTH. -- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com Read my blog at: http://cuttingtheredtape.blogspot.com/ ,---- | Great wits are sure to madness near allied, | And thin partitions do their bounds divide. | | (John Dryden, Absalom and Achitophel, 1681) `----
On 15 May 2006, at 13:26, Surendra Singhi wrote:> Peter Szinek <peter@rubyrailways.com> writes: > >> Hello all, >> >> Yet another "don''t reinvent the wheel" n00b question: >> >> Is there an ''official'' page hit counter plugin/code snippet/whatever? > > I don''t think so. > > But there are many commercial as well as free ones out there. I > will recommend > Statcounter www.statcounter.com (google if link fails). > > Put the code in you layout files.Or if you want to manage it yourself, use a before_filter that adds it to the database. Plain and simple. Best regards Peter De Berdt
Apply for a Google Analytics account. It''s way better than anything you can build for yourself. I tried to home-rolled approach, and let me tell you, its disappointingly complex. Plus, you need to store thousands of records, which will slow your app down. -- Posted via http://www.ruby-forum.com/.