Feature Flags
Feature flags let you control feature availability without code deployments.
Creating a Flag
Via Dashboard
- Navigate to Flags in your dashboard
- Click New Flag
- Enter a unique key (e.g.,
new-pricing-page) - Add a description
- Set up targeting rules
- Save and enable
Via API
bash
curl -X POST https://api.experimentplus.io/v1/flags \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"key": "new-pricing-page",
"description": "New pricing page design",
"enabled": true
}'Evaluating Flags
typescript
// Simple boolean check
const isEnabled = await client.isEnabled('new-pricing-page', {
userId: 'user-123'
})
// With default value
const isEnabled = await client.isEnabled('new-pricing-page', {
userId: 'user-123',
default: false
})Targeting Rules
Percentage Rollout
Roll out to a percentage of users:
json
{
"rules": [
{
"type": "percentage",
"percentage": 25
}
]
}User Attributes
Target based on user properties:
json
{
"rules": [
{
"type": "attribute",
"attribute": "plan",
"operator": "equals",
"value": "enterprise"
}
]
}Specific Users
Target specific user IDs:
json
{
"rules": [
{
"type": "users",
"userIds": ["user-123", "user-456"]
}
]
}