Finding how many times was my website visited?

21 views
Skip to first unread message

Maddy

unread,
Dec 19, 2012, 6:54:20 AM12/19/12
to rubyonra...@googlegroups.com
Hi Everyone,

Good Day!

I wanna to add to my blog a counter for displaying, how many times was my website visited. I would like to solve it through ruby (not GA or something like that). Is available any gem that do this task (also with checking IP address,the time of latest visited and visited count).


Please Advice.

Thank You.

Dennis Krupenik

unread,
Dec 19, 2012, 8:02:02 AM12/19/12
to rubyonra...@googlegroups.com
check newrelic_rpm
Message has been deleted

Ashokkumar Yuvarajan

unread,
Dec 19, 2012, 10:04:46 AM12/19/12
to rubyonra...@googlegroups.com
Hi Crispin Schäffler,

Good Day !

As you said i followed your instructions, but i got an error..

It is my application controller,

class ApplicationController < ActionController::Base
  before_filter :track

def track
  trackobject = Track.new(:date => Time.now, :ip => "#{request.env['REMOTE_ADDR']}") unless session[:tracked] 
 session[:tracked] = true 
end

end
Inline image 1r
Please advice!

Thank you.


On Wed, Dec 19, 2012 at 3:01 PM, Crispin Schäffler <crispins...@gmail.com> wrote:
def track
  trackobject = Track.new(:date => Time.now, :ip => "#{request.env['REMOTE_ADDR']}") unless session[:tracked] (and again what you want to have
 session[:tracked] = true (if you want that visitor only tracked once on your page
end



--
"Attitude is a little thing that makes a big difference"

Thanks & Regards
Ashokkumar.Y
ROR-Developer
email : ashok...@shriramits.com
Shriramits



error.png

Crispin Schäffler

unread,
Dec 19, 2012, 10:59:30 AM12/19/12
to rubyonra...@googlegroups.com
well... thats what happens if you write it quick and dirty. it was not meant to be copy and paste... sorry... but what exactly is line 7 of your applications controller? did you have sessioons enabled?

Colin Law

unread,
Dec 19, 2012, 11:14:31 AM12/19/12
to rubyonra...@googlegroups.com
On 19 December 2012 10:59, Crispin Schäffler
<crispins...@gmail.com> wrote:
> well... thats what happens if you write it quick and dirty. it was not meant
> to be copy and paste... sorry... but what exactly is line 7 of your
> applications controller? did you have sessioons enabled?

I think maybe the problem is that it should be
trackobject = Visit.new( ...

@OP I assume you are a newcomer to Rails.
I think you might benefit from working right through a good tutorial
such as railstutorial.org
which is free to use online.

Colin

>
> Am Mittwoch, 19. Dezember 2012 07:54:20 UTC+1 schrieb Maddy:
>>
>> Hi Everyone,
>>
>> Good Day!
>>
>> I wanna to add to my blog a counter for displaying, how many times was my
>> website visited. I would like to solve it through ruby (not GA or something
>> like that). Is available any gem that do this task (also with checking IP
>> address,the time of latest visited and visited count).
>>
>> Please Advice.
>>
>> Thank You.
>
> --
> 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 rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-ta...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/ox5on2Nl6EMJ.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Thota praneeth

unread,
Dec 19, 2012, 11:20:05 AM12/19/12
to rubyonra...@googlegroups.com
I hope you don't have 
Track Model with date and IP fields.
Thanks and Regards
  Praneeth Thota
    9966590143
Reply all
Reply to author
Forward
0 new messages