mint-metrics / mojito-js-delivery

🧪 Source-controlled JS split testing framework for building and launching A/B tests.
https://mojito.mx/docs/js-delivery-intro
Other
16 stars 29 forks source link

Use local storage rather than cookies for persistence #31

Open kingo55 opened 4 years ago

kingo55 commented 4 years ago

Cookies can be problematic with how much data is transmitted and processed by some web/application servers and we don't need Mojito cookies server-side.

Perhaps we should provide an option for localStorage or consider migrating all over to localStorage.

dapperdrop commented 4 years ago

@kingo55 would it make sense to approach it like #28? i.e. give users ability to customise persistence methods. We could make localStorage the new default and override to cookies in shared code as we migrate across?

kingo55 commented 4 years ago

@dapperdrop - I think a config flag is most useful here.

Default to localStorage and have something like Mojito.options.useCookies = true; to toggle to cookies. Will be able to keep the cookie utilities functions for use in variant code then too.

dapperdrop commented 4 years ago

@kingo55 OK cool, that makes sense to me.

kingo55 commented 4 years ago

We should think about this issue some more because it will impact #40 and we'll probably need a pathway to migrate old containers from cookies to local storage.

Of course if users are getting random numbers from a user seed/hash, then it shouldn't really matter, because they will get pretty much the same recipe unless they were excluded by sample during ramp up.