You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Are variants persisted in cookie copied to redis on login ? #483
Only users in Price:control may can see variants for Payment.
Users see a Price variant before they authenticate.
Then they log in.
Then they see Payment variants.
After login, I seem to lose the variant data that was stored in a cookie, and it is not persisted to Redis. This is a problem, because I am explicitly verifying inclusion in the Payment group before exposing Provider variants.
I am getting around this by persisting Split variants to a Rails session, which is persistent before and after login.
I would expect that Split variant data for a user would also persist through a user session.
Is this known behavior?
If I can provide any more information to clarify the issue, please ask.
--
I am running Rails 4.2.7.1, and Split 1.6.0
I thought a Split update might resolve the issue, but upgrading to 3.0.0 (testing locally) does not seem to resolve the issue.
Reacted by Ian Pearce, Sergii Mostovyi and Deans Charbal
I also had this misconception about the DualAdapter. From looking at the code, it doesn't look like the DualAdapter supports transferring data between the logged out adapter and the logged in adapter. This feature would be awesome to have, but for now it's probably most helpful to just add a line to the README to prevent any future confusion (I can try to do this if I have time.)
@avifoxi I was able to manually transfer A/B data from my logged out adapter (CookieAdapter) to my logged in adapter (RedisAdapter) by initializing adapters and getting/setting values directly.
A warning though: I suspect that Split's reporting might then count users who have data in both logged in and logged out adapters as 2 distinct A/B test users.
EDIT: the code above alone will not add another user to Split's reporting, however calling ab_test again when the user is logged in will.
@nitsujri FYI, I ended up going with a different solution (one that covered only the specific test that I wanted to transfer) so I can't really report much about my experience with that code snippet. IIRC, it was intended to go in any controller actions that logged a user in (e.g. login and signup).
I was thinking that maybe a behavior where it first looks in Redis and if it's not there it looks in the cookies could make more sense than the DualAdapter behavior. Would the following adapter solve this issue?
On #588 we added the possibility of recovering the alternative selected via the Dual Adapter. It's not the default behavior yet but can set fallback_to_logged_out_adapter = true when setting up split.
Activity
tony-pizza commentedon Aug 9, 2017
I also had this misconception about the
DualAdapter. From looking at the code, it doesn't look like theDualAdaptersupports transferring data between the logged out adapter and the logged in adapter. This feature would be awesome to have, but for now it's probably most helpful to just add a line to the README to prevent any future confusion (I can try to do this if I have time.)@avifoxi I was able to manually transfer A/B data from my logged out adapter (CookieAdapter) to my logged in adapter (RedisAdapter) by initializing adapters and getting/setting values directly.
For instance, you could do something like this...
A warning though: I suspect that Split's reporting might then count users who have data in both logged in and logged out adapters as 2 distinct A/B test users.EDIT: the code above alone will not add another user to Split's reporting, however calling
ab_testagain when the user is logged in will.nitsujri commentedon Jun 28, 2018
@peeinears Thanks for this, I was running into the same issue.
Where do you stick this code?
Not sure what the
selfcontext is referring to.tony-pizza commentedon Jun 28, 2018
@nitsujri No prob. I put it in the controller.
tony-pizza commentedon Jun 28, 2018
@nitsujri FYI, I ended up going with a different solution (one that covered only the specific test that I wanted to transfer) so I can't really report much about my experience with that code snippet. IIRC, it was intended to go in any controller actions that logged a user in (e.g. login and signup).
nitsujri commentedon Jun 28, 2018
@peeinears makes sense. I think the key is the concept that you delivered and you deserve the credit to put it into the docs!
santib commentedon Oct 4, 2019
I was thinking that maybe a behavior where it first looks in Redis and if it's not there it looks in the cookies could make more sense than the
DualAdapterbehavior. Would the following adapter solve this issue?andrehjr commentedon Jul 5, 2020
On #588 we added the possibility of recovering the alternative selected via the Dual Adapter. It's not the default behavior yet but can set
fallback_to_logged_out_adapter = truewhen setting up split.