kangguru / rack-google-analytics

Simple Rack middleware for implementing google analytics tracking in your Ruby-Rack based project. Supports synchronous and asynchronous insertion and configurable load options
MIT License
257 stars 53 forks source link

undefined method 'track_ga_event' for [controller] #16

Closed davev closed 11 years ago

davev commented 11 years ago

using Rails 3.2.13.

in config/application.rb: config.middleware.use Rack::GoogleAnalytics, { :tracker => ENV["GOOGLE_ANALYTICS_URCHIN_ID"], :async => true }

in any controller: track_ga_event(current_user.email, "Page View", request.try(:path_info)) if current_user

i get a NoMethod Error: undefined method 'track_ga_event' for ...

it's not recognizing the two instance methods. am i missing something obvious? tia.

jontonsoup commented 11 years ago

did you ever solve this?

davev commented 11 years ago

no, ended up just including the custom event/user var calls directly as javascript.

ddefrenne commented 11 years ago

The file which would include track_ga_event into the controller was never being called. It's fixed in https://github.com/leehambley/rack-google-analytics/pull/17.

kavyavj commented 11 years ago

I am using rack-google_analytics (1.0.2) and still getting NoMethodError:undefined method `track_ga_event' in Rails 3.2.13