react-native-mixpanel
react-native-mixpanel copied to clipboard
Allow `timeEvent` to be ended with `trackWithProperties` (or even better, deprecate `trackWithProperties` altogether and use `track`)
According to the documentation for web, it looks like you can end the timeEvent
along with custom properties:
mixpanel.time_event('Registered');
mixpanel.track('Registered', {'Gender': 'Male', 'Age': 21});
However, in the react native version, if you try and end a timeEvent
with trackWithProperties
:
Mixpanel.timeEvent('some event);
// some async operation taking time
Mixpanel.trackWithProperties('some event', { name: 'Dan' });
the event gets logged in Mixpanel but the duration
field is blank. If you end the timeEvent
with track
instead of trackWithProperties
:
Mixpanel.timeEvent('some event);
// some async operation taking time
Mixpanel.track('some event');
the duration
field is in the event in Mixpanel but you don't get the other properties you passed.
The underlying question really is, why the differentiation between track
and trackWithProperties
? Why not, like the web version, just use track
and it can take an optional object of parameters?
+1