How can I have a feature toggle disabled for everyone, except listed UserIDs?

Vote:
 

How can I have a feature toggle disabled for everyone, except listed UserIDs?

I'm using C# and the latest SDK. I have tried this, however the feature toggle keeps coming through as true.
I'm using _optimizelyInstance.IsFeatureEnabled("anzapi", "someUserGuid");
No matter what I use for the userId, it always comes back as true.

#322010
May 14, 2024 6:40
Vote:
 

I think the easiest method to do that without redoing your delivery rule would be to change the traffic split so that it's 100% "Off" and 0% "On" then use your allow list (as you have done) to define the user IDs for whom it should be switched on.

If your intention is to roll out the feature solely to targeted users, I suspect a better option would be to create an audience which represents the users who should receive the feature and then use a targeted delivery rule for that audience rather than an A/B test rule.

#322013
May 14, 2024 7:44
Vote:
 

Hi David

According to your requirement, the best match Flag rule is "Targeted Delivery" .  Before we dive into technical implementation, there are some basic core concepts I would like to make it bit clear so it will help you to faciliate better use cases in the future.

First of all, the basic of feature flag is on and off by default. Let's say you develop a feature A on your website, and once you release this feature to production, you can only make it on or off. When it's off, it means no one can use this feature in theory. It's that simple. In your case, what you really want is "An enabled feature (on) that is only avaiable (roll out) to a specific group (custom audiences) of users"

Secondly, accordiong to the outcome above, we'll need to choose the right rule(s). When you're already confident what features you would like to delivery to your end user, you should use "Targeted Delivery". In your case, you have already known you only want to show feature to a specific group of users. (Of course you can combine with A/B test rule, it's another level of complexity and I won't  discuss this here)

Finally, it's the time to figure out what needs to be implemented to achieve this requirement. I see the list of things will need to be set up / configure first

  • A new flag
  • An audience that can be used to match a list of users 
  • Targeted Delivery rule that leverages your audience group

Once everything has be done, you will need to pass "UserAttributes" data to IsFeatureEnabled function in your code and you'll get enable set to false if the user doesn't match the your audience criteria. 

I hope above helps you to get better understanding of Optimizely feature experimentation. 

#322016
May 14, 2024 11:31
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.