You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: contents/docs/feature-flags/creating-feature-flags.mdx
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,28 @@ A payload is an additional piece of information sent to your app when a flag is
72
72
73
73
They enable you to configure functionality related to your flag inside PostHog, instead of having to make code changes or redeploy your app.
74
74
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.
0 commit comments