1

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 : https://gist.github.com/renegadeandy/835a7fb0db2bb9d8ea95)

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 :)

Shadwell
  • 34,314
  • 14
  • 94
  • 99
RenegadeAndy
  • 5,440
  • 18
  • 70
  • 130

1 Answers1

3

The problem was that the server had not been restarted :'(

Closing the server and reopening it - solved the problem!

RenegadeAndy
  • 5,440
  • 18
  • 70
  • 130