Skip to content

Update flags docs for dynamic config support in experiments#2710

Open
efahk wants to merge 1 commit into
mainfrom
efahk_dynamic
Open

Update flags docs for dynamic config support in experiments#2710
efahk wants to merge 1 commit into
mainfrom
efahk_dynamic

Conversation

@efahk
Copy link
Copy Markdown
Contributor

@efahk efahk commented May 18, 2026

Feature flags now support JSON config as feature flag values in experiment flags. This change updates the public documentation for consistency.

@efahk efahk requested a review from a team as a code owner May 18, 2026 21:50
@efahk efahk requested review from Tofufu and removed request for a team May 18, 2026 21:50
@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 18, 2026 9:55pm

Request Review

Copy link
Copy Markdown
Contributor

@russell-loube-mixpanel russell-loube-mixpanel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work — this is close. Three small suggestions inline:

  1. Rename the section to Experiment JSON Parameters (the original name risked overlap with our marketing language).
  2. Drop the string-only example and lean into the JSON object case, which is the more compelling story.
  3. Clarify what "rejected" means — i.e., the flag can't be saved via UI or API.

Also added a small JS SDK snippet so readers can see the shape of the payload end-to-end.

One thing to confirm before merging:

  • The JS SDK method I used (mixpanel.flags.get_variant_value) is a placeholder — please swap in the real method name from the JS SDK reference.
  • Does the value type really stay changeable after creation, or only before any assignments exist? The wording "you can change a flag's value type later" should match real behavior.

Comment on lines +76 to +84
### Variant Values

Each variant can optionally carry a **value** in addition to its name, either a **string** or a **JSON** object. The variant name is what your code switches on to render the right experience. The value is configuration data the SDK returns alongside the assignment (e.g., a CTA label, a feature config object).

- The value type is chosen once per flag. Every variant in the flag must use the same type, either all string or all JSON.
- JSON values are validated when you save the flag; values that don't parse are rejected.
- Each variant's value has a 32 KB size limit.

This is the same mechanism used by [Dynamic Config](/docs/featureflags#types-of-feature-flags) flags, now available on Experiment flags as well.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Variant Values
Each variant can optionally carry a **value** in addition to its name, either a **string** or a **JSON** object. The variant name is what your code switches on to render the right experience. The value is configuration data the SDK returns alongside the assignment (e.g., a CTA label, a feature config object).
- The value type is chosen once per flag. Every variant in the flag must use the same type, either all string or all JSON.
- JSON values are validated when you save the flag; values that don't parse are rejected.
- Each variant's value has a 32 KB size limit.
This is the same mechanism used by [Dynamic Config](/docs/featureflags#types-of-feature-flags) flags, now available on Experiment flags as well.
### Experiment JSON Parameters
Each variant can optionally carry a **value** in addition to its name — either a **string** or a **JSON object**. The variant name is what your code switches on to render the right experience. The value is configuration data the SDK returns alongside the assignment, so you can remotely control parameters of your app or site (copy, colors, thresholds, layout configs, pricing, etc.) without a code deploy.
For example, a variant named `treatment` might carry a JSON object value like:
```json
{ "cta_text": "Buy now", "discount": 20, "layout": "compact" }
```
Your client reads `variant.value` after assignment and uses it to drive the UI.
- The value type is set per flag. Every variant in the flag must use the same type — either all string or all JSON. You can change a flag's value type later from the flag's settings.
- JSON values are validated when you save the flag. If a value doesn't parse as valid JSON, the flag can't be saved — whether you're editing in the UI or updating it via the API.
- Each variant's value has a 32 KB size limit.
#### Example: reading a variant value (JavaScript SDK)
```javascript
mixpanel.flags.get_variant_value("checkout_cta_experiment", { cta_text: "Buy" })
.then((value) => {
// value is the JSON object configured on the assigned variant
document.querySelector("#cta").innerText = value.cta_text;
});
```
This is the same mechanism used by [Dynamic Config](/docs/featureflags#types-of-feature-flags) flags, now available on Experiment flags as well.


1. **Feature Gate** : Toggle a feature on or off for targeted users or all users. Useful for phased or controlled rollout.
2. [**Experiment**](/docs/experiments) : Deliver different variant experiences (e.g., layouts, flows, pricing) to a targeted group of users. Enables measuring and analyzing impact.
2. [**Experiment**](/docs/experiments) : Deliver different variant experiences (e.g., layouts, flows, pricing) to a targeted group of users. Enables measuring and analyzing impact. Each variant can optionally carry a **string** or **JSON** value, letting you ship per-variant configuration (e.g., a CTA label, a layout config blob) alongside the variant name.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. [**Experiment**](/docs/experiments) : Deliver different variant experiences (e.g., layouts, flows, pricing) to a targeted group of users. Enables measuring and analyzing impact. Each variant can optionally carry a **string** or **JSON** value, letting you ship per-variant configuration (e.g., a CTA label, a layout config blob) alongside the variant name.
2. [**Experiment**](/docs/experiments) : Deliver different variant experiences (e.g., layouts, flows, pricing) to a targeted group of users. Enables measuring and analyzing impact. Each variant can optionally carry a **string** or **JSON object** value, letting you ship per-variant configuration (e.g., a CTA label, a layout config blob) alongside the variant name. See [Experiment JSON Parameters](/docs/experiments#experiment-json-parameters).

2. [**Experiment**](/docs/experiments) : Deliver different variant experiences (e.g., layouts, flows, pricing) to a targeted group of users. Enables measuring and analyzing impact. Each variant can optionally carry a **string** or **JSON** value, letting you ship per-variant configuration (e.g., a CTA label, a layout config blob) alongside the variant name.
3. **Dynamic Config** : Configure features with flexible key-value pairs instead of just on/off. It lets you:
- Pass JSON payloads (e.g., `{"cta_text": "Buy now", "discount": 20}`) to customize behavior or UI dynamically
- Pass **string** or **JSON** payloads (e.g., `{"cta_text": "Buy now", "discount": 20}`) to customize behavior or UI dynamically
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Pass **string** or **JSON** payloads (e.g., `{"cta_text": "Buy now", "discount": 20}`) to customize behavior or UI dynamically
- Pass **string** or **JSON object** payloads (e.g., `"Buy now"` or `{"cta_text": "Buy now", "discount": 20}`) to customize behavior or UI dynamically


<Callout type="info">
The JSON payload for Dynamic Config has a size limit of 32 KB.
Variant values (used by both Experiment and Dynamic Config flags) have a size limit of 32 KB per variant. Within a single flag, all variants must use the same value type, either all string or all JSON.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Variant values (used by both Experiment and Dynamic Config flags) have a size limit of 32 KB per variant. Within a single flag, all variants must use the same value type, either all string or all JSON.
Variant values (used by both Experiment and Dynamic Config flags) have a size limit of 32 KB per variant. Within a single flag, all variants must use the same value typeeither all string or all JSON object — and you can switch the type later from the flag's settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants