Closed sturgill closed 12 years ago
Hi @sturgill,
Please take a look at this commit https://github.com/zevarito/mixpanel/pull/46
it adds engage endpoint as well, I've take sometime to check both before merge. Thanks!
Following yesterday's back and forth with @GBH, I ended up rewriting a lot of the gem. This new approach allows for a single Mixpanel object to process multiple types of requests (track, import, set, increment, etc.).
It wouldn't be backward compatible with the current gem, but the code is a bit more organized and extendible.
Hi @sturgill, @GBH,
This feature implementation has become a big refactor, here is most of the code, but the discussion about implementation is happening in the other thread, so I will close this one for sake of simplicity and let's go back to the other one to continue the discussion.
This gem has done well with pushing events from a backend server, but I wasn't sure how to use it to push changes to people (using the set and add methods).
Sample code to set an attribute:
Sample code to use the increment function:
The
update_person
method takes 3 parameters: the unique identifier, what action to take (either:set
or:add
) and a hash of values to pass to the server (consistent with the JS API).In
Mixpanel::Tracker.new
, the options hash no longer has an:import
key, but has an:action
key (as shown above) that can be set to one of three options::track
,:import
, and:person
. The default value is:track
unless otherwise set.