-
Notifications
You must be signed in to change notification settings - Fork 18
Predefined variations documentation #638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
laliconfigcat
wants to merge
25
commits into
master
Choose a base branch
from
predefvariations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+176
−0
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
49ad14d
base
laliconfigcat f990485
docs
laliconfigcat e61d959
prg
laliconfigcat 6e060a5
prg
laliconfigcat 9731236
link fix
laliconfigcat 339f597
Apply suggestions from code review
laliconfigcat d02d92e
fix
laliconfigcat 9bf2d96
reorder
laliconfigcat 0a4e5fb
fix
laliconfigcat 57c5aa2
free form
laliconfigcat e6337f8
kind
laliconfigcat d6db586
reorder
laliconfigcat cc07877
kind
laliconfigcat d074af3
fields
laliconfigcat 897a19b
Merge branch 'master' into predefvariations
laliconfigcat 88cdd3b
sidebar
laliconfigcat 7833e22
Apply suggestions from code review
laliconfigcat 472af89
Apply suggestions from code review
laliconfigcat c79ed08
link fix
laliconfigcat b34aaeb
images
laliconfigcat 571f6ef
Apply suggestions from code review
laliconfigcat 7d96f74
more fixes
laliconfigcat 3a5b131
Apply suggestions from code review
laliconfigcat 5d3d387
link
laliconfigcat 652c42b
heading fix
laliconfigcat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| --- | ||
| id: predefined-variations | ||
| title: Predefined Variations | ||
| description: Learn about free-form values and predefined variations in ConfigCat, how they differ, and when to use each approach for managing feature flag values. | ||
| --- | ||
|
|
||
| ConfigCat supports two value-modes for feature flags: _free-form values_ and _predefined variations_. This guide explains the differences between these approaches and helps you choose the right one for your use case. | ||
|
|
||
|
|
||
| ## Overview | ||
|
|
||
| In ConfigCat, you can configure feature flags to operate in either of these modes: | ||
|
|
||
| - **Free-form values** - Allows arbitrary feature flag values. You can set served values to any value. | ||
| - **Predefined variations** - Constrains feature flag values to a set of variations specified beforehand. You can select served values from a dropdown. | ||
|
|
||
| <p> | ||
| <img src="/docs/assets/predefined-variations/usage_192dpi.png" alt="Clone feature flag" width="1366" height="768" decoding="async" loading="lazy" /> | ||
| </p> | ||
|
|
||
| ## Free-form values | ||
| Free-form values are the traditional, unrestrictive mode that lets you enter a feature flag's exact value each time you set it. | ||
|
|
||
| <p> | ||
| <img src="/docs/assets/predefined-variations/free-form-create_192dpi.png" alt="Clone feature flag" width="1366" height="768" decoding="async" loading="lazy" /> | ||
| </p> | ||
|
|
||
| ### Characteristics | ||
|
|
||
| - **Direct Input**: You type or input the value directly when setting up flag rules | ||
| - **Ad-hoc Definition**: Values are defined on-the-fly as needed | ||
| - **No Reusability**: Each value must be entered separately for each rule | ||
| - **Simple Setup**: Straightforward for basic use cases | ||
| - **Flexible**: Any valid value can be entered at any time | ||
|
|
||
| ### Use cases | ||
|
|
||
| Free-form values work well when you have simple, one-off configurations where feature flag values are unique and unlikely to be reused. They're ideal when you need quick setup without upfront planning, especially when working with primitive values like booleans or simple strings and numbers. This approach is also suitable when values change frequently or unpredictably. | ||
|
|
||
|
|
||
|
|
||
| ## Predefined variations | ||
|
|
||
| Predefined variations allow you to define a set of reusable values upfront when creating a feature flag. These variations can then be selected from a dropdown when setting up flag rules. Each variation consists of three fields: | ||
|
|
||
| <p> | ||
| <img src="/docs/assets/predefined-variations/predefined-variations-create_192dpi.png" alt="Clone feature flag" width="1366" height="768" decoding="async" loading="lazy" /> | ||
| </p> | ||
|
|
||
| ### Variation fields | ||
|
|
||
| | Field | Description | | ||
| |-------|-------------| | ||
| | Served value | **Required.** The actual value that feature flag evaluation will return in your application when this variation is selected. | | ||
| | Display name | Optional. A human-readable identifier for the variation displayed in the dropdown. If not provided, a string representation of the served value is displayed instead. | | ||
| | Hint | Optional. Additional context or description to explain when or why to use this variation. It will be visible as a tooltip. | | ||
|
|
||
| ### Characteristics | ||
|
|
||
| - **Defined at Creation**: Variations must be defined when creating the feature flag | ||
| - **Reusability**: Define once, use multiple times across flag rules | ||
| - **Consistency**: Ensures the same values are used throughout your configuration | ||
| - **Dropdown Selection**: Choose from predefined options instead of typing | ||
|
|
||
| ### Use cases | ||
|
|
||
| Predefined variations are ideal when you have a standard set of values used across multiple rules, especially when consistency is critical for things like color schemes, API endpoints, or configuration objects. They work well when multiple team members need to understand what each value represents and you want to prevent typos or invalid values. This approach is particularly valuable when complex values like JSON objects need to be reused, when you need to provide guidance on when to use specific values, and when values are known upfront and relatively stable. | ||
|
|
||
|
|
||
| ## Converting between free-form values and predefined variations | ||
|
|
||
| ConfigCat provides an easy way to convert feature flags between free-form values and predefined variations. | ||
|
|
||
| ### Converting to predefined variations | ||
|
|
||
| When you convert a feature flag from free-form values to predefined variations, ConfigCat automatically collects all currently used values from your existing flag rules. These collected values are presented as suggested variations, but you can modify their display names and hints, or even add new variations. | ||
|
|
||
| The conversion doesn't affect your deployed applications. | ||
|
|
||
| ### Converting to free-form values | ||
|
|
||
| When you convert a feature flag from predefined variations to free-form values, the actual values from variations are extracted and feature flag values are updated to use the values directly. Display names and hints are irreversibly deleted, leaving only the values. | ||
|
|
||
| The conversion doesn't affect your deployed applications. | ||
|
|
||
| ## Working with predefined variations | ||
|
|
||
| ### Creating a feature flag with predefined variations | ||
|
|
||
| When creating a new feature flag, you can choose between free-form values and predefined variations. | ||
|
|
||
| ### Managing predefined variations | ||
|
|
||
| You can add/remove/modify predefined variations for a feature flag by clicking the related button in any served value dropdowns or by clicking the **Manage predefined variations** item in the kebab (3 dots) menu of the feature flag. | ||
|
|
||
| <p> | ||
| <img src="/docs/assets/predefined-variations/manage_192dpi.png" alt="Clone feature flag" width="1366" height="768" decoding="async" loading="lazy" /> | ||
| </p> | ||
|
|
||
| You can create additional variations as needed at any time. However, you can only remove a predefined variation if it is not currently in use. | ||
|
|
||
| You can modify the display name and hint of predefined variations at any time, but you can only change the served value of a predefined variation if it is not currently in use. | ||
|
|
||
| ## Variation ID vs predefined variations | ||
|
|
||
| ConfigCat also has a feature called _Variation ID_, but this is different from predefined variations, as it is designed primarily for analytics and A/B testing integrations. It is a hashed identifier of the feature flag's served value. | ||
|
|
||
| However, since predefined variations require unique served values, there is an inherent connection between the two concepts: a Variation ID uniquely identifies a predefined variation. | ||
|
|
||
| Therefore, if you enable the Variation ID feature in your product's preferences as explained [here](../variation-id-for-analytics/#how-to-access-variation-ids), the **Manage predefined variations** dialog will also display the Variation IDs corresponding to the variations. | ||
|
|
||
| :::tip | ||
| Learn more about Variation ID [here](../variation-id-for-analytics). | ||
| ::: | ||
laliconfigcat marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| id: variation-id-for-analytics | ||
| title: Variation ID for analytics | ||
| description: Learn about how to utilize the Variation ID to enrich feature flag evaluation events. | ||
| --- | ||
|
|
||
| To support working with feature flags, especially A/B testing and analytics, ConfigCat provides an auto-generated identifier called Variation ID for each distinct served value. This identifier is particularly useful when integrating with analytics tools. | ||
|
|
||
| ## What is a Variation ID? | ||
|
|
||
| The _Variation ID_ is a hashed version of the feature flag's served value. For feature flags with lengthy values (such as JSON objects), the Variation ID provides a shorter, more manageable identifier that can be sent to analytics platforms, instead of the full value. | ||
|
|
||
| ## How to access Variation IDs | ||
|
|
||
| You can view Variation IDs on the ConfigCat Dashboard by enabling the **Show Variation IDs to support A/B testing** setting. Learn more about this setting <a href="https://app.configcat.com/product/preferences" target="_blank">here</a>. | ||
|
|
||
| ## Variation ID vs. PredefinedVariationID | ||
|
|
||
| :::note | ||
| `Variation ID` (for analytics) is different from `PredefinedVariationID` available in the Public Management API: | ||
|
|
||
| `Variation ID` is a hashed identifier of the feature flag's served value, used for analytics and A/B testing integrations. This is what you send to analytics tools like Amplitude, Google Analytics, Mixpanel, and Segment. | ||
| `PredefinedVariationID` is the resource identifier in the ConfigCat Public Management API that can be used to reference a specific predefined variation when managing feature flags programmatically. Read more at [Predefined variations](/advanced/predefined-variations). | ||
| ::: | ||
|
|
||
| ## Using Variation IDs with analytics integrations | ||
|
|
||
| When integrating ConfigCat with analytics platforms, you can send the Variation ID along with (or instead of) the feature flag value. This is especially recommended for text feature flags with lengthy values (such as JSON configurations), maintaining consistent identifiers across analytics reports, and simplifying A/B test analysis. | ||
|
|
||
| For detailed integration instructions, see the documentation of | ||
| - [Amplitude integration](/integrations/amplitude), | ||
| - [Google Analytics integration](/integrations/google-analytics), | ||
| - [Mixpanel integration](/integrations/mixpanel), | ||
| - [Segment integration](/integrations/segment). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+331 KB
website/static/assets/predefined-variations/free-form-create_192dpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+363 KB
...ite/static/assets/predefined-variations/predefined-variations-create_192dpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.