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' #21

Open kavyavj opened 11 years ago

kavyavj commented 11 years ago

ref: issue #16 I am still facing this problem please help me

kangguru commented 11 years ago

it looks like its fixed in the upstream but version 0.11.0 on rubygems is somehow broken. maybe @leehambley can publish a new version.

for the time being the workaround would be to use the master directly from github

leehambley commented 11 years ago

If someone wants to take over responsibility for this Gem, I'd be more than happy to hand over the Rubygems.org ownership, I don't have a lot of time to maintain this anymore.

kangguru commented 11 years ago

if you don't have the time anymore... i could take over.

leehambley commented 11 years ago

I'd be glad, I'll add you here, ping me at lee.hambley@gmail.com and let me know how I should add you at Rubygems (email, if you are already registered there.)

kangguru commented 11 years ago

i just released 0.12.0 @kavyavj would you give it a try?

kavyavj commented 11 years ago

Sure I will check the version 0.12.0 and revert back. Thanks for your time fixing it.

On Fri, Aug 9, 2013 at 10:25 PM, Lars notifications@github.com wrote:

i just released 0.12.0https://rubygems.org/gems/rack-google-analytics/versions/0.12.0 @kavyavj https://github.com/kavyavj would you give it a try?

— Reply to this email directly or view it on GitHubhttps://github.com/leehambley/rack-google-analytics/issues/21#issuecomment-22408292 .

tgautier commented 10 years ago

I still have the problem with 0.12.0 and Rails 3.2.15.

I can give a hand if needed to help fix this issue.

kangguru commented 10 years ago

but the actual ga snippit is correctly injected into the body? can you provide an example how you call the track_ga_eventmethod

ghost commented 10 years ago

Can you please update the read me

In your application controller, you may track an event. For example: ga_track_event("Users", "Login", "Standard")

it needs to be track_ga_event method.

kangguru commented 10 years ago

the method is named ga_track_event see: https://github.com/kangguru/rack-google-analytics/blob/master/lib/google-analytics/instance_methods.rb#L27

sorry for being wrong in my comment above

igorsantos07 commented 7 years ago

Oh well, same bug is happening here, many years after the report. I prefer using this gem instead of rack-tracker as I'm only looking for GA and this one is much simpler.

I tried setting the gem up both following the README instructions and using the Padrino plugin "googleanalytics". Both work fine, but they don't enable the additional methods on my controllers.

Fiddling around, I stumbled upon another set of helpers and got the idea of adding helpers GoogleAnalytics::InstanceMethods to my app/app.rb. Voilà, Padrino got to know GA and they're happy working together. I'm not sure how this would be implemented into the gem, tho; maybe an additional rule in the README?

To help my app not send calls during development I enclosed the use call into a conditional. That doesn't cause errors when calling the controller methods. Here's the final code I'm using:

helpers GoogleAnalytics::InstanceMethods
configure :production do
  use Rack::GoogleAnalytics, :tracker => 'UA-12345678-9'
end

I'm using Padrino 0.10.6 (yep, old, gonna update it later). Maybe this could be of help to anyone :)