Hello, I have a question regarding splitting user...
# ask-questions
p
Hello, I have a question regarding splitting users by attribute. Specifically, I want to assign users to a specific URL, e.g., "/payment", and maintain this split until the experiment is over. However, what I currently observe is that a user receives the test on the "/payment" page, but if they reload the application, they stop being part of the experiment unless they visit the "/payment" page again. How can I resolve this issue? Thank you in advance.
f
There are two ways. One would be to make sure you're firing a useEffect (or similar) on URL change to update the URL attribute, which would reenroll the user on that page. The other is if you assign the experiment to all users, and then use the page_view event for the "/payment" page used as a activation metric, which will filter out users who never saw the experiment.
p
I also have a few more questions: 1. I created a feature for users without the hasPremium attribute. However, when a user became premium they are no longer part of that experiment. How can I fix this? 2. And is it possible to see the current feature value without enabling an experiment? Thank you!
h
1. This is a pretty good use case for using sticky bucketing GB app: https://docs.growthbook.io/app/sticky-bucketing SDK: https://docs.growthbook.io/lib/js#sticky-bucketing 2. I might be misunderstanding the question, but usually you'd want to use a dev environment to test out features and experiments before making them live. You can also use the "Test Feature Rules" widget on a feature page to debug
p
2. For example when an user has a specific test after visiting /payment page we want to change the header on the main page for variation 1. But how we can check that user included in the experiment on the main page? gb.getFeatureValue(<feature_name>) immediately put user in the test cause it fired trackingCallback function
h
I don't think there's anything in GB right now that supports #2, but you can easily roll your own solution. Once the experiment enrollment happens and you get a result, set a cookie or localStorage entry for that user to remember that they have been exposed to a specific experiment variant. Then in your header render logic, check for that flag being set. If the header is set server-side, a cookie is probably best.
👍 1
p
Thank you!
@happy-autumn-40938 I've tried GrowthBook bucketing but unfortunately I still cannot save experiment for users who bought premium. If attribute hasActivePremium is true test variation became default even with bucketing. Is there any possible solution to fix this?