- Optimizely X Full Stack
THIS ARTICLE WILL HELP YOU:
- Create and deploy new features and feature configurations
- Develop and iterate on your features
- Use feature configurations to change your features and create variations without a deployment
Features are major parts of your product that you want to test and roll out to your visitors. A regular A/B test is reserved for testing smaller changes to your website or product. A feature is a bigger part of your product, like your checkout process or your product sorting algorithm. With Optimizely’s Feature Management, you can test how new product features compare to your existing product and carefully roll your features out to a specific percentage of your traffic.
In Optimizely, features are reusable: define and implement a feature once, then use it in multiple experiments, like a series of feature rollouts or feature tests. In our example, if your new checkout doesn’t test well, you can turn it off, redesign it, and test it again. When your new checkout tests well, roll it out to more traffic.
Create a feature
Here’s how to create a new feature, with step-by-step instructions below:
Click Features > Create New Feature…
Give the feature a unique key (and a description, if you like). Your feature key can contain letters, numbers, and special characters, but no spaces. You’ll use the feature key to determine whether the feature is on or off in your code.
Click Create Feature.
Rollout controls the ability to turn the feature on or off and specify the percentage of traffic for which a feature is enabled. Rollouts for new features default to OFF: 0% of traffic allocated. You can adjust rollout as needed as you iterate on and refine your feature.
Deploy a feature
At the bottom of the Create New Feature modal, Optimizely automatically populates example code for an API call with your feature key:
Deploy this example code with your code for your feature. In your codebase, use optimizely.isFeatureEnabled to determine whether to show the feature to a visitor. The
isFeatureEnabled API always returns a boolean value. To deploy features and control the execution of the associated code, fetch the value of this boolean. If true, execute the code associated with the feature. If false, skip the code associated with the feature. The experiments you define in Optimizely then determine the state of the boolean (in other words, the state of the flag).
Use feature configurations to specify how the feature will behave for different audiences: whether it will be on or off, what variable values to show, and so on.
For features without feature configurations, all you need to do is define the feature and deploy the API call. The example code allows you to turn the feature on by defining a feature rollout or feature test.
Add a feature configuration
Feature configuration is an optional set of one or more feature variables. Feature configurations allow you to make changes and create variations through Optimizely without deploying code.
Here’s how to add feature configuration variables, with detailed instructions below:
In the Features dashboard, click the name of the feature you want to configure.
Click Add Variable.
Type a unique variable key, select a type, and enter a default value for each variation in the configuration.
Click Add Variable to add another variable.
Click Save when you are finished adding variables for your feature.
The default values are always returned by Optimizely’s feature variable accessors unless they’re overridden by a variation in a feature test or a variation in a multivariate test.
If a feature test is running on a feature that uses a feature configuration, the feature configuration will be locked until you pause the feature test.
Deploy a feature configuration
When you add a feature configuration, Optimizely updates the feature’s example code to include feature variable accessors:
Retrieve feature variables using these four type-specific accessors:
Optimizely will return the default values for feature variables in these circumstances:
If a feature is disabled (as a safeguard in case you reference the variable even when the feature is disabled)
As part of a feature rollout
As part of a feature test (unless the default values are overridden by a variation)
The only way to override default feature variable values is as part of a feature test variation.