How can I see real-time user activity in Rails 3?

What I would like to do is what my user admin will be able to see - in real time (through some nice AJAX / jQuery) - what my user is doing.

How should I do it?

I assume that it has something to do with session activity - and I started saving the session in db, not a cookie.

But generally speaking, how can I take this information and analyze it in real time?

I looked at my session table and besides identifiers (id and session_id), I see a data field. This data field contains a hash that I cannot understand (looks like an md5 hash).

How can I use this to see that user A just clicked on link B, and right after that, user B clicked on link A, etc.?

Is there a gem - besides a bell - that can help me?

+3
source share
3 answers

Session data contains only values ​​stored in session[]-hash from the user. It does not remember which action / controller was triggered, so you do not know which "link was clicked".

Get the activity of your users:

In addition to rackamole, you have two IMHO options.

  • Use before_filterin yours ApplicationControllerto save the information you are interested in. (Controller name, action or URI, additional parameters and registered user ID, for example).

  • AJAX- , (URI, ..) . , , . , Rails- . AJAX- PHP- script, . .

:

/ , . , , .. .

Realtime vs. Oldschool:

, . ( , , ), . AJAX Push .

, (- ).

, , , , ( ).

+2

, Mixpanel. , .

+4

Perhaps you can test https://github.com/raid5/acts_as_scribe#readme It also works with Rails 3.

+1
source

Source: https://habr.com/ru/post/1794883/


All Articles