Releasing new features to a small audience first using feature flags
Tags: featureflags, deployment, targeting, segmentation
Published: 2019-11-14 14:10:12

Do you have a product with a consistent user base and you are releasing **new features**? Then you need to decide whether it’s enough to just test these features in- house. This decision is always tricky, because sometimes it really is useful to receive feedback from a wider audience without the risk of imposing the new feature on your more important or so-called “sensitive users” (major companies that were pleased with your facilities and services up to the present, and you cannot risk the collaboration with them).

If you are facing this dilemma, [ConfigCat](https://configcat.com)‘s feature flags for targeting might provide you with a solution.

Let’s say you have a product like Instagram, and the company decided to add new poll-boxes, quiz types and options for embedding links in the stories while removing some of the older ones.

Using feature flags you will have the opportunity to enable certain features to certain group of users. Let’s say you would like to enable a feature only for the users within your company or only to a small percentage of your users (maybe in one country only) before releasing it to the entire world. In addition, you might want to exclude big companies, like H&M or Victoria’s Secret until you have received the favourable feedback from your employees, “friendly users” and a small percentage of app-users or even users from a selected area (country).

Even though in this article it’s exemplified with [ConfigCat](https://configcat.com), targeting works just fine with other feature flag tools as well — for example with [Unleash-hosted](https://www.unleash-hosted.com). The process of targeting special users goes down in the following way:

First step: you need to enable the feature:

1. Log in to access the Management Console
1. Go to **Feature Flags & Settings**
1. Select **TARGET SPECIFIC USERS** after clicking the actions icon

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/afucpl8pnipkaje4gcis.jpeg)

After you turned on the feature flag, you will be able to target specific users.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/0iiulp7py57pif3o4crv.png)

### How does the targeting rule work?

By adding a rule you can specify a group of your users whom a new feature will be enabled or a different value will be served. A rule consists of an **Attribute** of a user in your application, a **Comparison value** (e.g. a list of email addresses) and a **Comparator**. [ConfigCat](https://configcat.com) evaluates the targeting rule every time your application requires and decides what value to serve.

A property of the user is considered as an **attribute**, and it can vary between e-mail address, country, and identifier or custom (you can add highly specific attributes such as eye colour).

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/4lz7rmut2orl838vk2ec.png)

The **comparison value** is any string, number or comma separated list to be compared with the selected attribute using the **comparator**. It can be a list of e-mail addresses, companies or users in a specific country.

The **comparator** has four different setting options and it marks the selection of the users with a specific attribute from the list (comparison value).

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/p8cxa3yi5c6dyxka6tbs.png)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/zgeantwef41hztoj3gqi.png)

The term **‘served value’** mentioned before refers to the exact value that will be served to the users that fall into that fraction. Depending on the kind of your setting this could be:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/12s93x592fftfqkcoj9e.png)

In our example the On/Off Toggle is relevant because that is the usual state of a feature flag, but [ConfigCat](https://configcat.com) offers a range of different setting kinds and types.

You actually have multiple options in choosing the served value of the feature flag, for example, it can be the On/Off Toggle presented above (note: here the number of options must be 2), but if you decide to use Text and/or Number the maximum number of your options entirely depends on your subscription plan. You can add/remove options by clicking the Actions icon.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/kbjtctnv0sm08ztw4cp0.png)

Once you’ve enabled your feature for the list of your employees for instance, you can add multiple targeting rules and ordering by clicking on the Actions icon; thus you can create more complex rule sets.

* Rule sets are evaluated one by one, **from top to bottom direction**.
* Change the order of targeting rules by **drag n’ drop**.

*Example*

Enable a feature only to users within your company except the PR team (Connor and Natasha) by adding two targeting rules:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/xfj4jpeddcpy2g2nxxmx.png)

To all other uses serve: OFF

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/sawqu4lrbh2yiagfeopd.png)

This value will be served as a fall-back if none of the above rules apply or a User Object was not passed to the [ConfigCat](https://configcat.com/docs/sdk-reference/overview) correctly within your application.

You can also target a **percentage of users**. If you enable a new feature on a platform like Instagram, you might want to be granted public feedback by including a randomly selected fraction of your users whom a feature will be enabled, or a different value will be served. The sum of all % values must be equal to 100.

1. Select **TARGET % OF USERS** after clicking the actions icon.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/fyr6ux9mlga2ux29swut.png)

To sum up, targeting can prove to be great help in **experimenting with new features** while offering you and your company a risk-free path to gather feedback from the targeted users. Feature flags provide you with **a safe environment** with the option of changing your mind.