Skip to main content

Beginners guide":" Targeting, Segmentation, and Canary Releases

· 4 min read
Zoltan David

You created a new software feature, put it behind a feature flag, and deployed it to production. Now, you want to enable this new feature to some of your users, so you get early feedback, before releasing the new feature to your whole userbase.

But whom to release the new feature first? How to choose the first user segment? And how to target them with feature flag rules?

Lets see some typical real world examples how big companies do it.

Release based on Company, or Email address#

A great first step is to enable the new feature to your colleagues, while keeping it hidden from the rest of the world. This enables you to get early feedback from users inside of your company. You'd be surprised how much bug they'll catch on the first day!

Here is how you can segment and target your colleagues with one simple rule in ConfigCat:

Dogfooding: releasing your software's new feature to the users from your own company

The example above assumes that everyone in your organization has an email address in the form of [email protected], or [email protected].

Note how we used the Email property, and the CONTAINS operator to target only those users who work for your company.

This is what needs to be done in your application at the code level:

var user = new User("<userid>") { Email = "[email protected]" };var god_mode_enabled = client.GetValue("god_mode_enabled", false, user);

Please note, how we used the god_mode_enabled key and the user object here to check whether God Mode is enabled for [email protected].

The example above is in C#, but you can do the same in Java, JS, Python, Go, Ruby, Swift, Kotlin, PHP etc. See examples in other languages.

Release on a Country basis#

Another typical strategy is to release new features to users from a specific country only. This strategy enables you to get feedback from a lot of users, while still avoiding a global impact.

Segmenting by country or geolocation

The image above shows how to target all users in Germany. This is a large segment of users, and this partial release is probably a good indicator of what would happen if you'd release the new feature to the whole world!

Note how this targeting rule is similar to the one we used for dogfooding. It makes use of the Country property, and the IS ONE OF operator.

In order to enable your Product Manager to segment users based on their country, just fill the Country property of the user object in your code:

var user = new User("<userid>") { Email = "[email protected]", Country = "Germany" };var god_mode_enabled = client.GetValue("god_mode_enabled", false, user);

Let me show you a trick.#

You can achieve the same results in an alternative way:

Alternative targeting by country or geolocation

Here we targeted everyone NOT in Germany with an OFF value, while enabling the feature to the rest of the world (which is Germany).

After the basic examples lets see a few more powerful ones.

Platform, Country and Version#

This is how you release a feature to Android app users in Germany, and only for users who are using version 5.3 and above.

Alternative targeting by country or geolocation

At the code level, add the keys OS, and AppVersion to the Custom property of your user object:

var user = new User("<userid>") {               Country = "Germany",               Custom = { { "OS", "Android" }, { "AppVersion", "5.4" }           };           var god_mode_enabled = client.GetValue("god_mode_enabled", false, user);

Everyone in My Company, plus Android users from Germany, above v5.3#

I'm sure you get it now:

Alternative targeting by country or geolocation

First we target our own colleagues with an ON. Then we make sure non-Android users will not get the feature. Then we ensure not to release the feature to anyone under version 5.3. And exlude everyone except Germany. And finally enable the new feature to the rest of the world (which is everyone with apps > 5.3 in Germany).

This is the code:

var user = new User("<userid>") {               Email = "[email protected]",               Country = "Germany",               Custom = { { "OS", "Android" }, { "AppVersion", "5.4" }           };var god_mode_enabled = client.GetValue("god_mode_enabled", false, user);

Yes, but what if?#

Do you have any other scenario in mind? If you find ConfigCat is not powerful enough for you, just drop us an email at [email protected] We will help you. Either by adding a new feature to ConfigCat, or showing you how you can use ConfigCat's existing features to reach your goal.