Closed lourd closed 2 years ago
hi @lourd , now you will be able to set a storage interface other than PlayerPrefs.
call SetPreferencesSource
to set the data persistence of your choice as long as it follows IPeferences.
For example:
Mixpanel.SetPreferencesSource(<your own persistence>);
I'm closing this one now, but feel free to reopen it if you need further help.
When using this library in the WebGL build of our Unity application, we've seen a portion of users run into an issue with PlayerPrefs running out of storage:
We debugged this and discovered that the exception is coming from the Mixpanel library. If a user has an ad blocker on that causes the requests to api.mixpanel.com to fail, events continue to be put into PlayerPrefs, eventually blowing the 1MB limit and causing this exception and crashing our application.
We've worked around this by making a HEAD request from our application code to
https://api.mixpanel.com/track
and using the success or failure of that to determine if we should disable the Mixpanel library, but it would be great if the library handled this better — clearing out the cache when the limit is reached, or some kind of ring buffer, or offering some other way to configure storage thresholds.It would also be really helpful if the library used a storage interface other than PlayerPrefs, perhaps even allowing that to be configurable if need be, since its 1 MB limit on WebGL builds is so small.
We are also looking into setting up a proxy server for ourselves, like the Mixpanel docs recommend. But the problem would still remain for certain conditions, such as operating offline.