lib/mixpanel/tracker.rb in mixpanel-1.1.1 vs lib/mixpanel/tracker.rb in mixpanel-1.1.2
- old
+ new
@@ -27,10 +27,16 @@
params = build_event(event, options)
parse_response request(params)
end
def ip
- @env.has_key?("REMOTE_ADDR") ? @env["REMOTE_ADDR"] : ""
+ if @env.has_key?("HTTP_X_FORWARDED_FOR")
+ @env["HTTP_X_FORWARDED_FOR"].split(",").last
+ elsif @env.has_key?("REMOTE_ADDR")
+ @env["REMOTE_ADDR"]
+ else
+ ""
+ end
end
def queue
@env["mixpanel_events"]
end