marvelapp / react-ab-test

A/B testing React components and debug tools. Isomorphic with a simple, universal interface. Well documented and lightweight. Tested in popular browsers and Node.js. Includes helpers for Mixpanel and Segment.com.
MIT License
240 stars 47 forks source link

Cookie storage added as option #28

Open b10z opened 2 years ago

b10z commented 2 years ago

Table of Contents

Description

Cookies added as a storage option. A new storeCookie.jsx was added that contains a funtion with get and set cookies functions. A new emitter flag (enableCookies) and its setter and getter were added to keep in track user preferences.

Motivation and Context

This feature was requested here https://github.com/marvelapp/react-ab-test/issues/21 .

How Has This Been Tested?

Changes were tested in two projects. One vanilla React with almost nothing on it except google analytics, and in one bigger unreleased project with many different cookies. All of my tests were completed successfully, including "yarn test" as described. Also, messing with the values from cookies and local storage while enabling and disabling cookies storage seems to work nice and smooth (All variations showed up as expected).

Screenshots (if appropriate):

Types of changes

Checklist:

New emitter function "setCookie" needs to be mentions to the documentation as well. By setting emmiter.setCookie(true) the module uses cookies as storage. Default option is local storage.

Whatever you may need, please let me know.