olahol / react-ab

Simple declarative and universal A/B testing component for React.
431 stars 24 forks source link

Isomorphic? #1

Closed robcolburn closed 9 years ago

robcolburn commented 9 years ago

I was excited by the name and the example, but looking at the code it appears you're using the DOM for cookies. How do you manage that back on the server?

olahol commented 9 years ago

By default and for convenience the component uses browser cookies, but you can override this by setting the get, set and del props on the component.

https://github.com/olahol/react-ab#get-set-and-del

robcolburn commented 9 years ago

@olahol, Looking into this, it does seem rather difficult to make genetic. The difficulty seems to be because we need access to the {{request}} which is not local in NodeJs.

You could theoretically write those methods back somewhere before rendering react, and pass them down. Makes sense.

I'm curious if you've been able to pull this off with any 3rd party A/B vendors, or is it just internal?

olahol commented 9 years ago

I'm sorry I completely forgot about this issue, I have addressed some of the concerns about the isomorphic aspect of the component in version 0.4.0. Check out the example in the readme and see if it works for you.

thebigredgeek commented 8 years ago

Why not use react-cookies? It's isomorphic and you can plug the cookies from req.cookies to save the context and then draw isomorphically from react-cookies rather than document cookies... @olahol

olahol commented 8 years ago

@thebigredgeek , looks nice, I will look into it.