samedi 25 avril 2015

Ahoy is not recording events or visits


I have installed Ahoy to give some user analytics on my rails application. I am running rails 4.1.10 and using Postgres 9.3.10

I have added the gem to my gemfile:

gem 'ahoy_matey'

And I have run :

rails generate ahoy:stores:active_record -d postgresql
rake db:migrate

As per the docs.

I also added //=require ahoy after jquery in the application.js assets file.

I was not sure if visits and events would be tracked automatically - so I went to a couple of pages and checked manually in the DB and I see no entries in the visits or ahoy_events tables. So I manually coded this into my landing page index controller action:

ahoy.track "Viewed Landing", title: "Landing page viewed"

And this line causes the following error:

NameError in LandingPageController#index
undefined local variable or method `ahoy' for #<LandingPageController:0x007fa634fee7f0>

(Listed in full here : http://ift.tt/1Fm5sTH)

Can anybody help me get ahoy logging visits and events please! Ideally I want it to track everything, automatically if there is some golden switch I need to press :)


Aucun commentaire:

Enregistrer un commentaire