Skip to content

Commit 201d88a

Browse files
docs: Enhance multivariate flag payload documentation (#15376)
Add comprehensive multivariate flag payload section explaining how to configure different payloads per variant and use release conditions to target specific audiences.
1 parent e5516fd commit 201d88a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

contents/docs/feature-flags/creating-feature-flags.mdx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,28 @@ A payload is an additional piece of information sent to your app when a flag is
7272

7373
They enable you to configure functionality related to your flag inside PostHog, instead of having to make code changes or redeploy your app.
7474

75-
If you're using remote config flags, you can use payloads to pass configuration values to your application.
75+
#### Boolean and Remote Config Flag Payloads
76+
77+
- **Boolean flags**: Can have a single payload that is returned when the flag is enabled
78+
- **Remote config flags**: Always return the same payload for all users (meant for static configuration)
79+
80+
#### Multivariate Flag Payloads
81+
82+
For multivariate flags, you can configure **different payloads for each variant**. This allows you to serve different configurations, content, or parameters based on which variant a user receives.
83+
84+
**How to set up variant-specific payloads:**
85+
86+
1. Create a multivariate flag with multiple variants (e.g., `control`, `variant_a`, `variant_b`)
87+
2. For each variant, configure a unique payload in the **Payloads** section
88+
3. Use release conditions with **optional overrides** to force specific users to specific variants
89+
4. Retrieve the payload in your code using `getFeatureFlagPayload('flag-key')`
90+
91+
**Example use cases:**
92+
- **A/B testing different pricing structures**: Each variant returns different pricing configuration
93+
- **Content personalization**: Different variants serve different UI copy, colors, or layouts
94+
- **Feature configuration**: Each variant enables different sets of features or functionality
95+
96+
To force specific users or audiences to receive specific variants (and their associated payloads), use [optional overrides](/docs/feature-flags/testing#method-1-assign-a-user-a-specific-flag-value) in your release conditions. This allows you to target different user segments with different configurations while maintaining a single feature flag.
7697

7798
### Release conditions
7899

0 commit comments

Comments
 (0)