ruby on rails - ahoy_meta gem don't work -
can please me how create event ahoy_gem , how visits tracked. follow documentation provided gem developer, can't me how use it. please me.
firstly check if track visits, head rails console
, run visit.any?
if returns true
tracking visits!
if doesn't track visits, can add code below application_controller.rb
:
after_action :ahoy_track protected def ahoy_track ahoy.track_visit end
now track visits.
in order track events have 2 options:
- track events in server side.
- track events in client side using js.
to track in server side should use the:
ahoy.track "event name", properties: { one: "val", two: "val" }
this create record in db event named "event name" properties one: "val", two: "val"
to track events in client side using js:
ahoy.track("event name", {one: "val"});
- tracking in js won't create records in db,
a post request sent /ahoy/events with
(from documentation) , need handle there.
another thing: if want check events can access them ahoy::event
or visit: visit.ahoy_events
Comments
Post a Comment