Learn how to target specific users or groups with your feature flags.
Targeting rules allow you to control which users see which features. You can target users based on various attributes and conditions.
Target based on user properties like email, role, or custom attributes
Gradually roll out features to a percentage of users
Target specific environments (development, staging, production)
Create complex targeting rules using boolean logic
You can target users based on various attributes:
Here's how to use targeting in your code:
// Target specific users const isEnabled = await client.isEnabled('new-feature', { userId: 'user-123', email: 'user@example.com', role: 'admin' }); // Percentage rollout const isEnabled = await client.isEnabled('new-feature', { userId: 'user-123', percentage: 50 // 50% of users }); // Custom targeting const isEnabled = await client.isEnabled('new-feature', { userId: 'user-123', customAttributes: { plan: 'premium', betaTester: true } });