Run a beta by showing a flag to a specific subset of users, instead of rolling your flag out to a random percentage of your user base.
Create a flag
An attribute is a property in your data that can be used to target a flag to a given customer or user. Decide which attribute to use for your beta based on the data you have available in your application. For example:
If you have a business application that has multiple accounts and want to run a beta account by account, consider making the unique account identifier in your application an attribute in Optimizely (ex:
If you have a consumer application with multiple users, and you'd like to run your beta user by user, consider making the unique user identifier in your application an attribute in Optimizely (ex:
The next step is to create an attribute in Optimizely for the attribute selected above. For example, if you were running a beta by enabling flags for a particular
customerId, create an attribute in Optimizely with the key
In your code, pass the value from the data available in your application as an attribute to create a user. The below example shows how you would do this if you were running a beta based on
// create a hardcoded beta user. Edit this example to fetch accountID & userID (for example, from customer dB) let user = optimizely.createUserContext(userId: "123", attributes: ["customerId": 789]) let decision = user.decide(key: "new_feature") // execute code based on flag enabled state let enabled = decision.enabled
Once you've implemented the attribute you will use for the beta, Target audiences for the beta users of your flag.
Name: Include the flag key in the audience name, so you can easily determine which flag this audience is for. For example, if your flag key was
chat_window, we recommend naming the audience "[chat_window] Beta Users"
Audience conditions: Drag and drop the attribute that determines who gets access to the beta. For the value of the condition, use an internal or test identifier to include yourself into the beta first to make sure everything is correctly set up.
Be sure to match the value with the attribute's appropriate type.
- If your attribute is an integer, be sure to select "Number equals".
- If your attribute is a string, be sure to select "String equals".
Create a targeted delivery for the audience you created previously and save, ensuring that the percentage delivery is configured to 100%:
Now that you've added the audience to your flag, your beta is running. After your first beta audience, you can retain them at 100% and strategically roll out to a sequence of audiences using multiple targeted deliveries. For example, you could define audiences to roll out to such as:
- other beta audiences
- lowest value customers
- difficult migration customers
- all customers signing up in the last 20 days
- highest value customers
When all your audiences are at 100% traffic, you're launched! Congratulations!
To optimize your feature flag during or after a delivery, test variations of your flag. For more information, see Run A/B tests.
Updated 4 months ago