zevarito / mixpanel

Simple lib to track events in Mixpanel service. It can be used in any rack based framework.
MIT License
273 stars 84 forks source link

Filter request.env #31

Closed brupm closed 12 years ago

brupm commented 12 years ago

Rather than passing in the entire request.env we're trying to filter the hash and submit only the needed params as such:

@env = {}
["HTTP_X_REQUESTED_WITH", "HTTP_X_FORWARDED_FOR", "REMOTE_ADDR", "mixpanel_events"].each do |key|
  if env.has_key?(key)
    @env[key] = env[key]
  end
end

and instantiating as such:

Mixpanel::Tracker.new(AppConstants.mixpanel, @env, true)

It seems as we may be filtering too many params as the referrer isn't being tracked properly. Any idea which params we should not be filtering out in order to get the referrer tracker properly?

zevarito commented 12 years ago

@brupm are you deploying in Heroku?

brupm commented 12 years ago

Yes, cedar stack.

zevarito commented 12 years ago

@brupm Heroku uses HTTP_X_FORWARDED_FOR so I am not sure what is the deal.

Using the real env instead the custom one, it works ok?