railslove / rack-tracker

Tracking made easy: Don’t fool around with adding tracking and analytics partials to your app and concentrate on the things that matter.
https://www.railslove.com/open-source
MIT License
647 stars 121 forks source link

syntax error, unexpected ':', expecting keyword_end (SyntaxError) #154

Closed ketandoshi closed 4 years ago

ketandoshi commented 4 years ago

When started the server after installing the rack-tracker version 1.12.1, it raises an error as below:

/.rvm/gems/ruby-2.2.10/gems/rack-tracker-1.12.1/lib/rack/tracker/google_global/google_global.rb:62: syntax error, unexpected ':', expecting keyword_end (SyntaxError)
      WARNING: One of the trackers specifie...
              ^
/.rvm/gems/ruby-2.2.10/gems/rack-tracker-1.12.1/lib/rack/tracker/google_global/google_global.rb:62: syntax error, unexpected tIDENTIFIER, expecting :: or '[' or '.'
...ified for Rack::Tracker handler 'google_global' is empty.
bumi commented 4 years ago

what ruby version do you use? but the main problem seems to be that your google_global tracker configuration is wrong. Can you review that? Do you have an id configured there?

ketandoshi commented 4 years ago

@bumi

ruby version 2.2.10

google analytics is configured as below:

config.middleware.use(Rack::Tracker) do
  handler :google_analytics, { tracker: 'ga-key', ecommerce: true }
end
DonSchado commented 4 years ago

2.2. was EOL 2 years ago, are you able to use a newer Ruby, or is this a legacy environment?

ketandoshi commented 4 years ago

@DonSchado Actually mine is a legacy environment. I can give it a try for newer version to check. But if people are using legacy environment, then it would be a problem for sure I guess.

DonSchado commented 4 years ago

Reading the code in google_global.rb the only obvious non 2.2. Syntax is the "squiggly" HEREDOC <<~

If you make a PR to fix that and test if the rest works with 2.2., I'm happy to make a new release for you.

bumi commented 4 years ago

@ketandoshi any update on this? could you get it working? (if so, a PR would be nice ;)