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

sandbox and production server #30

Closed juanpayph closed 10 years ago

juanpayph commented 10 years ago

In my application.rb can I have this code?
config.middleware.use Rack::GoogleAnalytics, :tracker => 'UA-45xxxxxx-x' if Rails.env.sandbox? config.middleware.use Rack::GoogleAnalytics, :tracker => 'UA-x3xx40xx-1' if Rails.env.production?

I have different tracker for production server and sandboxing. Is this correct?

jhilden commented 10 years ago

what makes you think that this shouldn't work?

kangguru commented 10 years ago

yes. you can go with this solution.

or you can place it in the specific environment configuration found under:

config/environments/production.rb config/environments/sandbox.rb

as "sandbox" isn't a default rails environment you'd have to create the file first.