samzilverberg/cordova-mixpanel-plugin

init bug in SDK is preventing queues from flushing

Closed this issue · 7 comments

uooq commented

This issue in the iPhone SDK is rendering the plugin useless:
mixpanel/mixpanel-iphone#241

The issue report lists a workaround that could be implemented in this plugin, or one could simply set up a timer in the cordova app and call mixpanel.flush() once per minute (that's the default that happens inside the SDK).

I believe that it's fine to just blindly try the flush() once per minute, regardless of connection state... I think the mixpanel SDK does this internally & if the app isn't connected, it keeps the events around and just tries again a minute later.

haha i think i half-noticed this myself, and noticed that pausing/resuming the app would flush :)
is it fixed in newer version of the sdk?

sorry for not checking in earlier

uooq commented

Looks like the Mixpanel team was worried that because folks have already implemented a workaround in their calling code, that fixing might cause problems. Here's the thread.

I think the best fix for this plugin would be to set the flushInterval and flushInBackground as described in the first comment on the issue report. The init call would still fail to start the timer but that comment implies that setting those values would then get it to start and a JS client calling your plugin wouldn't need to set up a flush timer.

Depending on when you get to this, we may beat you to it & fork your repo to handle this and add a couple of other things (like wiring up counters and superproperties). We'll be happy to open a pull request if/when we do. Note, though, we're only planning on the iOS src.

Any update to this? :)

i was hoping mixpanel or @uooq would be me to it.
I haven't checked mixpanel ios sdk in a while, will do.

@uooq : maybe you can save me some time and already know if its fixed? or perhaps you have actually already done it?

uooq commented

hi fantastic to see this go in...

No, we never got around to forking/fixing... we've still got our manual flush poller running... kept meaning to tackle it but never got around to it. :)