rack-google-analytics icon indicating copy to clipboard operation
rack-google-analytics copied to clipboard

undefined method 'track_ga_event'

Open kavyavj opened this issue 12 years ago • 11 comments

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

kavyavj avatar Jul 18 '13 07:07 kavyavj

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

kangguru avatar Aug 08 '13 16:08 kangguru

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.

leehambley avatar Aug 09 '13 10:08 leehambley

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

kangguru avatar Aug 09 '13 12:08 kangguru

I'd be glad, I'll add you here, ping me at [email protected] and let me know how I should add you at Rubygems (email, if you are already registered there.)

leehambley avatar Aug 09 '13 12:08 leehambley

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

kangguru avatar Aug 09 '13 16:08 kangguru

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 [email protected] 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 .

kavyavj avatar Aug 12 '13 13:08 kavyavj

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.

tgautier avatar Nov 20 '13 10:11 tgautier

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

kangguru avatar Nov 22 '13 15:11 kangguru

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.

ghost avatar Mar 14 '14 03:03 ghost

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

kangguru avatar Mar 14 '14 07:03 kangguru

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

igorsantos07 avatar Mar 05 '17 22:03 igorsantos07