https://www.growthbook.io/ logo
m

most-kilobyte-17608

03/31/2023, 6:22 AM
Hey. I’ve setup a A/B experiment with target condition lets say x=0. On visiting the site, user enters the experiment & gets the variation A. But after getting the variation, x changes to 1. How can i get the same assigned experiment value in future as
useFeature
starts returning the default value as the condition x=0 isn’t met now?
I see that the extension is able to detect the variation assigned to the experiment. Is there a way to determine that in code too?
1
f

fresh-football-47124

03/31/2023, 6:59 AM
are you changing the targeting condition based on them being inside the experiment?
m

most-kilobyte-17608

03/31/2023, 7:03 AM
Kind of yes.
I wan’t to assign the user to an experiment based on the initial attributes, and then change the conditions as attributes might change
Found a way to do so but don’t know if it is correct or not. @fresh-football-47124 Let me know if there is a better way of doing this When
onFeatureUsage
is called when x=0, set a growthbook attribute
x_exp_1: A
and change the targetting condition to
Copy code
{
  "$or": [
    {
      "x_exp_a": {
        "$exists": true
      }
    },
    {
      "x": {
        "$equals": 0
      }
    }
  ]
}
f

fresh-football-47124

03/31/2023, 9:10 AM
That can work - as long as you’re okay with the possibility of people switching variations should those attributes change
m

most-kilobyte-17608

03/31/2023, 9:45 AM
Any other way to do so right now? As the above implementation depends on persisting the attributes. Ideally shouldn’t the experiment variation persist once the user have entered the experiment?
3 Views