Hi, Anyone can point me in the right direction... I have a very simple rails app and I want to do a page view counter for it so that I can display how many people have viewed a given page on it since day one and also in the last 24 hours... I have seen this in some php sites before... I searched a bit but it did not lead me to anything remotely close for a rails app. if anyone has a link to some site where this had been done please share it. I am a newbie btw :( thanks Señor. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
señor tower wrote:> Hi, Anyone can point me in the right direction... > I have a very simple rails app and I want to do a page view counter > for it so that I can display > how many people have viewed a given page on it since day one > and also in the last 24 hours... > > I have seen this in some php sites before... > I searched a bit but it did not lead me to anything remotely close for > a rails app. > if anyone has a link to some site where this had been done please > share it. > I am a newbie btw :( > > thanks > Se�or.Why not just use Google Analytics? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
umm, I wasn''t -still not sure - that google analytics can be used to display public data... But I will see what i find! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''m relatively new to ruby on rails, but launching the server with -- debug and throwing debugger into an application_controller before_filter, I was able to determine where the URI was stored: request.env[''REQUEST_URI''] If you could grab this value and throw it into a table and/or increment its counter, you could easily retrieve the count later. There''s probably ActiveRecord magic where you can add it if it is new, otherwise increment the record''s count column. The simplest table to match your listed requirements would be to have URI and date columns as the primary key, then you will have a history of counts on a per day basis including the current day (though no greater granularity for the current day). Please post if you find a solution. Mike On Feb 6, 6:55 am, señor tower <senortow...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, Anyone can point me in the right direction... > I have a very simple rails app and I want to do a page view counter > for it so that I can display > how many people have viewed a given page on it since day one > and also in the last 24 hours... > > I have seen this in some php sites before... > I searched a bit but it did not lead me to anything remotely close for > a rails app. > if anyone has a link to some site where this had been done please > share it. > I am a newbie btw :( > > thanks > Señor.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
señor tower wrote:> umm, I wasn''t -still not sure - that google analytics can be used to > display public data... > But I will see what i find!You probably shouldn''t be displaying your counter anyway... Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks for our unfounded point of view Marnen. I still would like to know if anyone else has come across anything similar. a simple hit counter... to display some basic metrics. thanks so much. señor. On Feb 6, 12:31 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> señor tower wrote: > > umm, I wasn''t -still not sure - that google analytics can be used to > > display public data... > > But I will see what i find! > > You probably shouldn''t be displaying your counter anyway... > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Humm... thought I posted something to this thread, but nothing has shown up. I''m sure you are looking for something more out-of-the-box, but I thought I''d share with you what I just discovered myself should it be useful to you. Disclaimer: I''m a relative newbie to Rails. After starting the script/server with --debug and calling debugger in an application_controller before_filter, I was able to find the URL within request.env[''REQUEST_URI'']. If you create a model with URI and date as a unique key, you could create a new URI+date it it doesn''t exist and increment a counter each time a page is viewed. It shouldn''t take more than an hour to implement (maybe three for me as a newbie ;-) -- Mike On Feb 6, 9:40 am, señor tower <senortow...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks for our unfounded point of view Marnen. > > I still would like to know if anyone else has come across anything > similar. > a simple hit counter... to display some basic metrics. > thanks so much. > > señor. > > On Feb 6, 12:31 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > > señor tower wrote: > > > umm, I wasn''t -still not sure - that google analytics can be used to > > > display public data... > > > But I will see what i find! > > > You probably shouldn''t be displaying your counter anyway... > > > Best, > > -- > > Marnen Laibow-Koserhttp://www.marnen.org > > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, On Sat, 2010-02-06 at 09:40 -0800, señor tower wrote:> Thanks for our unfounded point of view Marnen. > > I still would like to know if anyone else has come across anything > similar. > a simple hit counter... to display some basic metrics. > thanks so much.We did something on a project I worked on a while back that might be relevant. It was audit functionality but the ''bones'' of it were pretty much what you''re talking about I think. The basics were to install a before_filter to record the method being invoked. That''s close to a page hit counter. You''d probably want to tweak it if you''re app includes Ajax renders. HTH, Bill -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.