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

Issue with unique users on Heroku #23

Closed georgekitchit closed 12 years ago

georgekitchit commented 12 years ago

For all of my ruby mixpanel calls, there seems to be an issue with anonymous users not being marked as different uniques. I know in the api it says that if an identify call is not passed, the ip address is utilized as a part of the uniqueness check. However, it seems like with the gem call, that uniqueness is not being stored.

Is this a problem with the actual gem, or the fact that our service is running through heroku? (without hostname ssl).

zevarito commented 12 years ago

I think I undertand what is happening and it could be fixed in the gem itself, I will check this out EOD or Tomorrow, thanks.

2011/12/19 George Tang reply@reply.github.com:

For all of my ruby mixpanel calls, there seems to be an issue with anonymous users not being marked as different uniques. I know in the api it says that if an identify call is not passed, the ip address is utilized as a part of the uniqueness check. However, it seems like with the gem call, that uniqueness is not being stored.

Is this a problem with the actual gem, or the fact that our service is running through heroku? (without hostname ssl).


Reply to this email directly or view it on GitHub: https://github.com/zevarito/mixpanel/issues/23

Alvaro

georgekitchit commented 12 years ago

I wrote a temp fix to generate an identifier, and identify whenever there isnt a signed in user

   def generate_identifier
      now = Time.now.to_i  
      Digest::MD5.hexdigest(
      (request.referrer || '') + 
      rand(now).to_s +  
      now.to_s + 
      (request.user_agent || '')
      )
    end

    identity = generate_identifier
    @mixpanel.append_api("identify", identity)
georgekitchit commented 12 years ago

Any updates on this? My temp fix didnt seem to work =(

zevarito commented 12 years ago

Hello,

I've pushed to master what should be fixing your problems, can you try it from there? If it goes ok I will push a new version of the gem.

Thanks.

georgekitchit commented 12 years ago

I saw your only change was to tracker.rb, so I just added lib/mixpanel/tracker.rb and copied your file into it to override the default gem tracker. Will let you know hopefully by tomorrow if it works

zevarito commented 12 years ago

Cool, also if you are using Bundler you can fetch the gem from the repo like this...

gem 'mixpanel', :git => "git://github.com/zevarito/mixpanel.git"

2011/12/22 George Tang reply@reply.github.com:

I saw your only change was to tracker.rb, so I just added lib/mixpanel/tracker.rb and copied your file into it to override the default gem tracker. Will let you know hopefully by tomorrow if it works


Reply to this email directly or view it on GitHub: https://github.com/zevarito/mixpanel/issues/23#issuecomment-3242660

Alvaro

georgekitchit commented 12 years ago

Didn't work so far, trying the fetched gem, will report back tomorrow

georgekitchit commented 12 years ago

Works! =)

georgekitchit commented 12 years ago

I assume you have added this to the main gem yes? No longer have to pull from git?

zevarito commented 12 years ago

hmmm of course... did you check it? :)