Closed abinoda closed 3 years ago
Not sure if this is officially supported but I came across https://github.com/ankane/ahoy/pull/411#discussion_r297085902
It looks like I could do:
ahoy.user = User.find(5)
ahoy.track "My first event", language: "Ruby"
Hey @abinoda, can you explain the use case a bit more?
One way to do it right now would be:
ahoy = Ahoy::Tracker.new(controller: self, user: user)
ahoy.track "My first event", language: "Ruby"
@ankane I have certain controller actions that load users indirectly, ie. through a tokenized URL.
Makes sense.
The approach above should work for that. I've added a user_id
option in the user_id_option
branch, but not sure if it's worth the extra complexity.
Cool. Yeah, I think the solution I have works. Would defer to you on whether offering the option makes sense. Thanks for your continued work on all these valuable open source projects! I previously built Pull Panda which heavily utilized groupdate and chartkick.
Thanks @abinoda
Hi @ankane. Is this working? I could not get Ahoy to set the user with
user = User.find_by(token: "my_token")
ahoy.track "User's calendar", {}, user_id: user.id
Hi @ankane. Is this working? I could not get Ahoy to set the user with
user = User.find_by(token: "my_token") ahoy.track "User's calendar", {}, user_id: user.id
doesn't seem to work for me either.
I have certain controllers/actions where
current_user
is not set. Is there any way to manually pass inuser
oruser_id
when creating an event?Something like this: