V
V
vdv_lg2015-06-05 18:09:19
Ruby on Rails
vdv_lg, 2015-06-05 18:09:19

Gem for ruby ​​on rails traffic metric?

Gentlemen, Ruby. Please tell me a gem to track site visitors. We need to count the number of unique visitors, and it is desirable to have built-in helpers for a nice graphic display (plotting a graph)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kononenko, 2015-06-05
@premas

There is no normal gem. If you do this with records in the database, it will slow down. I would do it on Redis.
We put Redis, we connect gems.

gem 'redis'
gem 'redis-rails'

We make ourselves config/initializers/redis.rb. We write there:
Then in application_controller.rb we write:
before_action :tracking_users
def tracking_users
  $redisTrackUsers.set(request.remote_ip, true, ex: 24*60*60) // через день поле уничтожится
end

users who have logged in in the last 24 hours:
And then whenever, for example, you can drop it into the database.
What does Yandex metric not suit you with?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question