Forum: Ruby on Rails Page hit counter?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F50f5d582d76f98686da34917531fe56?d=identicon&s=25 Peter Szinek (Guest)
on 2006-05-15 10:37
(Received via mailing list)
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
D449d54c3b0f8c9930c11c7d7d3e6cdd?d=identicon&s=25 Surendra Singhi (Guest)
on 2006-05-15 13:32
(Received via mailing list)
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.

>
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)
`----
00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2006-05-15 19:04
(Received via mailing list)
On 15 May 2006, at 13:26, Surendra Singhi wrote:

> 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
Fb23bc8cd4030c526b0689276b34c8bd?d=identicon&s=25 Bryan Duxbury (bryanduxbury)
on 2006-05-16 00:13
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.
This topic is locked and can not be replied to.