Skip to main content

Flags

Use flags to remotely control the behavior of your application.

Confidence Flags in Portal lets you remotely control the behavior in your application, like a website or a mobile app. For example, use flags to control the visibility of a feature, the behavior of a feature, or the behavior of a service.

Create a Flag

Follow these steps to create a flag:

  1. Go to your Portal instance and select Confidence flags on the left sidebar.
  2. Click + Create to create a new flag.
  3. Give the flag a name that can be used to uniquely identify it. It can't be changed later, so choose wisely.
  4. Select the clients that can use the flag.
tip

Use a name that is understandable and memorable. For example, new-navbar. Avoid too long names, and don't include the configuration in the name itself. For example, don't use new-navbar-mobile-experience, or new-navbar-enabled as the name of the flag.

The last step of the flag creation process is to associate the flag with clients. Not all clients should have access to all flags. For example, some flags might be sensitive and should only be available to clients that are running in an trusted environment.

tip

Mobile apps and websites batch resolve flags to reduce the number of requests made to Confidence. Associate a flag with a few clients as possible to limit the number of resolved flags.

To find instructions on how to use the SDKs for a particular flag, you can use Confidence's code snippet feature.

  1. Go to your Portal instance and select Confidence flags on the left sidebar.
  2. Go to the flag you want to preview the code for.
  3. Click Code snippets on the right sidebar.
  4. Select client and credential that you want to preview the code for.
  5. Pick the SDK you're interested in.

The code snippet shows you how to install, initialize, and resolve using the Confidence SDK.

You can associate a flag with more clients by following these steps:

  1. Go to your Portal instance and select Confidence flags on the left sidebar.
  2. Select the flag you want to add a client to.
  3. Click the icon next to Clients on the right sidebar to open up the clients dialog.
  4. Select the clients that should be able to resolve the flag.
  5. Click Save.

Archive a Flag

When a flag is no longer needed, you can archive it. Archiving a flag prevents clients from resolving and using it.

  1. Go to your Portal instance, and select Confidence flags on the left sidebar.
  2. Select the flag you want to archive.
  3. Click Archive in the right menu.

Edit Schema

Flags don't just describe a boolean decision to enable or disable a feature. Instead, flags have multiple properties that you use to control multiple aspects of the experience. The flag schema defines the available properties and their data type. The schema lets applications consume the flag value while knowing what to expect.

Confidence supports the following data types in the schema:

TypeDescriptionExample values
StringA string"HELO"
IntegerAn integer42, 199932
DoubleA double3.14, 50.0
BooleanBooleantrue, false
StructNested structure{ age: 23, country: "SE }
tip
  • Use short and descriptive name of the properties. For example, color is great.
  • Use boolean properties to represent the state of a feature. For example, use enable to represent if you should enable a feature or not.
  • Use kebab-case for property names: result-count is better than resultCount.
  • Avoid putting too much information in the name. For example, color is better than bgColor.

You can always add new properties to the schema.

tip

Program your clients so that they can always handle the presence of new properties in flag value.

You can change the name of a property if no variant sets a value for that particular property. The same is true for deleting a property from the schema. You can only delete a property if no variant sets a value for it. A lock icon next to the property in the schema editor dialog indicates if at least one property uses a variant.

To edit the schema for a flag, follow these steps.

  1. Go to your Portal instance.
  2. On the left sidebar, select Confidence flags.
  3. Go to the flag you want to edit the schema for.
  4. Click the edit icon next to Schema at the right sidebar of the flag detail page.
  5. Click Add property to add a new field to the schema.
  6. Select the type of the field, and give it a name.

Create a Variant

Use variants to implement different experiences of a flag.

A variant is a named set of values for the properties of the flag.

To create a variant, follows these steps.

  1. Go to your Portal instance.
  2. On the left sidebar, select Confidence flags.
  3. Go to the flag you want to add a variant to.
  4. Click Create variant on the flag page.
  5. Enter a name for the variant, and click Next.
  6. Optional. Enter a description, and input values for the properties of the flag.
tip

Use short and descriptive names, informed by the provided experience. Use kebab-case, like blue instead of Blue, and don't include too much information: use blue instead of blue-button-color. Avoid including the name of the flag in the variant name.

If a variant doesn't specify the value of a property, the SDK uses the default value specified when a client resolves the flag.