Rollouts

The Rollouts Developer Hub

Welcome to the Rollouts developer hub. You'll find comprehensive guides and documentation to help you start working with Rollouts as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Run a beta

Feature flags enable you to run a beta, so you can show a feature to a specific subset of users before releasing it to your general audience instead of rolling your feature out to a random percentage of your user-base.

This guide walks through how to run a beta and assumes you have a feature already created.

1. Decide on an attribute

An attribute is a property in your data that can be used to determine whether to target a feature to a given customer or user. Decide which attribute to use for your beta based on the data you have available in your application:

  • If you have a consumer application with multiple users, and you'd like to run your beta user by user, consider making the unique identifier that is associated with an individual user in your application an attribute in Optimizely (ex: userId).

  • If you have a business application that has multiple customers or accounts and want to run a beta customer by customer, consider making the unique identifier that is associated with an individual customer in your application an attribute in Optimizely (ex: customerId, accountId, projectId, etc.).

2. Implement the attribute

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 features for a particular customerId, create an attribute in Optimizely with the key customerId.

In your code, pass the value from the data available in your application to the Is Feature Enabled API as an attribute. The below example shows how you would do this if you were running a beta based on customerId:

// Implement the customerId attribute
int customerId = 123;

Map<String, Object> attributes = new HashMap<>();
attributes.put("customerId", customerId);

boolean enabled = optimizelyClient.isFeatureEnabled('new_feature', 'user123', attributes);

// Implement the customerId attribute
int customerId = 123;

UserAttributes attributes = new UserAttributes
{
  { "customerId", customerId },
};

bool enabled = OptimizelyClient.IsFeatureEnabled("new_feature", "user123", attributes);

// Implement the customerId attribute
int customerId = 123;

Map<String, Object> attributes = new HashMap<>();
attributes.put("customerId", customerId);

boolean enabled = optimizelyClient.isFeatureEnabled('new_feature', 'user123', attributes);

<OptimizelyProvider
  optimizely={optimizely}
  user={{
    id: 'user123',
    attributes: {
      customerId: 123,
    }
  }}
>
</OptimizelyProvider>
// Implement the customerId attribute
const customerId = 123;

const attributes = {
  customerId: customerId,
};

const enabled = optimizelyClientInstance.isFeatureEnabled('new_feature', 'user123', attributes);

// Implement the customerId attribute
const customerId = 123;

const attributes = {
  customerId: customerId,
};

const enabled = optimizelyClientInstance.isFeatureEnabled('new_feature', 'user123', attributes);

// Implement the customerId attribute
int customerId = 123;

NSDictionary *attributes = @{
  @"customerId": customerId
};

bool enabled = [client isFeatureEnabledWithFeatureKey:@"new_feature" userId:@"user123" attributes: attributes];

// Implement the customerId attribute
$customerId = 123;

$attributes = [
  'customerId' => $customerId,
];

$enabled = $optimizelyClient->isFeatureEnabled('new_feature', 'user123', $attributes);

# Implement the customerId attribute
customer_id = 123;

attributes = {
  'customerId': customer_id,
}

enabled = optimizely_client.is_feature_enabled('new_feature', 'user123', attributes)

# Change forceEnabled so the value is controlled by the test cookie
customerId = true

attributes = {
  'customerId' => customerId,
}

enabled = optimizely_client.is_feature_enabled('new_feature', 'user123', attributes)

// Change forceEnabled so the value is controlled by the test cookie
let customerId = 123

let attributes = [
  "customerId": customerId,
]

let enabled = optimizely.isFeatureEnabled(featureKey: "new_feature", userId:  "user123", attributes: attributes)

Note: The same attribute may appear twice in the API call

isFeatureEnabled(
  'new_feature',
  'userId123',           // UserId used for random percentage rollout
  { 
    userId: 'userId123', // Attribute used for non-random audience rollout 
    isVIP:  true,
  }, 
)

3. Create a beta audience

Once you've implemented the attribute you will use for the beta, create an audience for the beta users of your feature.

  • Name: Include the feature key in the audience name, so you can easily determine which feature this audience is for. For example, if your feature 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 setup.

Note: 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".

Add the audience you created above as a targeting condition to your feature and save, ensuring that the rollout is configured to 100%:

4. Add users to the beta

Now that you've added the audience to your feature, your beta is now running. Edit the audience definition to add or remove users from the beta:

  • Click on the "+" sign and save to add beta users
  • Click on the "x" sign and save to remove beta users

In this example, we've added three customers to the beta. Customers with ids: 123, 456, and 789

5. Launch

Once you are ready to launch your feature out of beta, follow these steps:

  1. Remove the audience from your feature
  2. Ensure the rollout is configured to 100%
  3. Save the feature

The feature is now available to everyone. Congratulations on using a beta to launch a feature!

Updated 5 months ago


Run a beta


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.