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

mixpanel.track send events without identification (doesn't use identify) #76

Closed rafmagana closed 11 years ago

rafmagana commented 11 years ago

Say I have an user which visited /my_page, and then clicked something which I track in a controller:

In WhateverController#my_action:

mixpanel.append('name_tag', user_email)
mixpanel.append('identify', user_id)
mixpanel.track('My Event')

In the Mixpanel site I see:

Streams > Users > user_email > Page View > Viewing /my_page
Streams > Users > Guest #xxxx > My Event

Mixpanel instance has async and persiste = true, I'm using the Middleware which both options to true too.

If I manually track the event in the JS console it works, Mixpanel shows:

Streams > Users > user_email > My Event

Any idea? thanks in advance.

rafmagana commented 11 years ago

Just realized that's because mixpanel.track send the request directly to the API, and that I should have used mixpanel.append_track to track the event via Javascript, I still think there should be a way to send distinct_id and name_tag, check this out https://mixpanel.com/docs/api-documentation/http-specification-insert-data. name_tag can be set via mp_name_tag, but well, in the meantime I'm going to use mixpanel.append_track, thanks!

zevarito commented 11 years ago

I am glad you figure it out. Closing this now.