Title: Use Cases and Examples Locale: en URL: https://sensorswave.com/en/docs/feature-gates/use-cases/ Description: Explore typical Feature Gate use cases and practical examples This article introduces typical Feature Gate use cases in real business scenarios, providing specific configuration examples and practical recommendations. ## Scenario 1: Gradual Rollout of New Features ### Business Scenario Your team has developed a new product recommendation algorithm and wants to verify its stability and effectiveness before a full Release. ### Solution Use a Feature Gate for progressive gradual rollout. ### Configuration Example **Feature Gate Configuration**: ``` Gate Name: recommendation_algorithm_v2 Display Name: Recommendation Algorithm V2 Gate Type: Temporary Gate Default Value: Disabled ``` **Rollout Rules**: | Phase | Rule Configuration | User Coverage | |-------|-------------------|---------------| | Internal Testing | `is_internal_user` = `true` | 0.1% | | Small-Scale Rollout | Percentage 1% | 1% | | Expanded Rollout | Percentage 10% | 10% | | Large-Scale Rollout | Percentage 50% | 50% | | Full Release | Default value changed to Enabled | 100% | ### Code Implementation ```javascript // Check if the new recommendation algorithm should be used const useNewAlgorithm = await sensorswave.getGateValue( 'recommendation_algorithm_v2', false ); let recommendations; if (useNewAlgorithm) { // Use the new algorithm recommendations = await getRecommendationsV2(userId); // Track Event for using the new algorithm sensorswave.trackEvent('RecommendationShown', { algorithm_version: 'v2', user_id: userId }); } else { // Use the old algorithm recommendations = await getRecommendationsV1(userId); // Track Event for using the old algorithm sensorswave.trackEvent('RecommendationShown', { algorithm_version: 'v1', user_id: userId }); } ``` ### Monitoring Metrics - **Click-through rate**: Click-through rate on recommended products - **Conversion rate**: Purchase conversion after clicks - **Response time**: Algorithm execution time - **Error rate**: Algorithm execution failure rate ### Expected Results - Click-through rate improvement of 15% - Conversion rate improvement of 10% - Response time stays under 200ms - Error rate 80% 3. **Quick Fallback**: Disable the recommendation system gate 4. **Use Fallback**: Display pre-set popular products 5. **Restore service**: Re-enable when load recovers ### Expected Results - System load drops 30% after Fallback - Core purchase flow is unaffected - Controlled decrease in user experience (recommendations still displayed) ## Scenario 3: Premium Feature Control ### Business Scenario A SaaS product offers Basic and Professional tiers. Professional users have access to advanced analytics features. ### Solution Use a Permanent Gate to control premium features. ### Configuration Example **Feature Gate Configuration**: ``` Gate Name: advanced_analytics_access Display Name: Advanced Analytics Gate Type: Permanent Gate Default Value: Disabled ``` **Paid User Rules**: | Rule Name | Condition | Return Value | |-----------|-----------|--------------| | Professional Users | `subscription_tier` = `professional` | Enabled | | Enterprise Users | `subscription_tier` = `enterprise` | Enabled | ### Code Implementation ```javascript // Check if the user has access to advanced analytics const hasAdvancedAnalytics = await sensorswave.getGateValue( 'advanced_analytics_access', false ); if (hasAdvancedAnalytics) { // Show advanced analytics features renderAdvancedAnalytics(); } else { // Show upgrade prompt renderUpgradePrompt({ feature: 'Advanced Analytics', requiredTier: 'professional' }); } ``` ### User Upgrade Flow ```javascript // After the user upgrades their subscription, update User Properties async function handleSubscriptionUpgrade(userId, newTier) { // Update User Properties await sensorswave.setUserProperty(userId, { subscription_tier: newTier, subscription_upgrade_date: new Date() }); // The Feature Gate automatically takes effect; the user immediately gets the new features } ``` ### Expected Results - Paid users automatically gain feature access - Access is automatically revoked upon downgrade - No code deployment needed to adjust permissions ## Scenario 4: User-Targeted Features ### Business Scenario Provide VIP users with an exclusive priority support entry to improve the experience of high-value users. ### Solution Use a Feature Gate for user targeting. ### Configuration Example **Feature Gate Configuration**: ``` Gate Name: priority_customer_support Display Name: Priority Support Gate Type: Permanent Gate Default Value: Disabled ``` **VIP User Rules**: | Rule Name | Condition | Return Value | |-----------|-----------|--------------| | VIP Users | `user_level` = `VIP` | Enabled | | SVIP Users | `user_level` = `SVIP` | Enabled | | High-Value Users | Cohort: High-Value Users | Enabled | ### Code Implementation ```javascript // Check whether to show the priority support entry const hasPrioritySupport = await sensorswave.getGateValue( 'priority_customer_support', false ); if (hasPrioritySupport) { // Show priority support entry renderPrioritySupportButton({ label: 'Exclusive Support', icon: 'vip-support', priority: 'high' }); } ``` ### Expected Results - VIP users see the exclusive support entry - High-value user satisfaction improves - Regular users use standard support channels ## Scenario 5: Seasonal Features ### Business Scenario Display special holiday themes and promotional activities during holiday periods, automatically closing when the holiday ends. ### Solution Use a Feature Gate to control seasonal features. ### Configuration Example **Feature Gate Configuration**: ``` Gate Name: spring_festival_theme Display Name: Spring Festival Theme Gate Type: Temporary Gate Default Value: Disabled ``` **Holiday Period Rules**: Enable and disable manually, or use scheduled rules (if supported): - Enable time: 2026-01-28 - Disable time: 2026-02-05 ### Code Implementation ```javascript // Check if the Spring Festival theme is enabled const enableSpringFestivalTheme = await sensorswave.getGateValue( 'spring_festival_theme', false ); if (enableSpringFestivalTheme) { // Apply the Spring Festival theme applyTheme('spring-festival'); // Show holiday promotional banner renderPromotionBanner({ title: 'Spring Festival Sale', image: '/assets/spring-festival-banner.jpg' }); } else { // Use the default theme applyTheme('default'); } ``` ### Expected Results - Holiday theme automatically displayed during the holiday - Automatically reverts to the default theme when the holiday ends - No code deployment needed ## Scenario 6: A/B Test Pre-Stage ### Business Scenario A new checkout flow needs to first verify stability, then verify effectiveness through an A/B test. ### Solution First use a Feature Gate to verify stability, then use an A/B test to verify effectiveness. ### Configuration Example **Step 1: Feature Gate for Stability Verification** ``` Gate Name: new_checkout_flow_enabled Display Name: New Checkout Flow Gate Gate Type: Temporary Gate Default Value: Disabled ``` Gradual rollout 1% → 10% → 50%, verifying no technical issues. **Step 2: A/B Test for Effectiveness Verification** After the Feature Gate is fully enabled, create an A/B test: ``` Experiment Name: Checkout Flow Optimization Experiment Experiment Type: A/B Test Control: Old checkout flow Test Group: New checkout flow Allocation: 50% vs 50% ``` ### Code Implementation ```javascript // Step 1: Check the Feature Gate (verify stability) const isNewCheckoutEnabled = await sensorswave.getGateValue( 'new_checkout_flow_enabled', false ); if (!isNewCheckoutEnabled) { // Feature not enabled, use the old flow renderLegacyCheckout(); return; } // Step 2: A/B Test (verify effectiveness) const experimentVariant = await sensorswave.getExperimentVariant( 'checkout_flow_optimization' ); if (experimentVariant === 'treatment') { // Test Group: new checkout flow renderNewCheckout(); } else { // Control: old checkout flow renderLegacyCheckout(); } ``` ### Implementation Timeline | Phase | Tool | Goal | Duration | |-------|------|------|----------| | Gradual Rollout Verification | Feature Gate | Verify feature stability | 1-2 weeks | | Effectiveness Verification | A/B Test | Verify business impact | 2-4 weeks | | Full Release | - | Release to all users | - | ### Expected Results - Technical risk is controllable - Business effectiveness is verifiable - Decisions are data-backed ## Scenario 7: Regional Customization ### Business Scenario Chinese users can pay via WeChat Pay and Alipay; international users can use PayPal and credit cards. ### Solution Use Feature Gates for regional customization. ### Configuration Example **WeChat Pay Gate**: ``` Gate Name: wechat_pay_enabled Display Name: WeChat Pay Gate Type: Permanent Gate Default Value: Disabled ``` **Rule Configuration**: | Rule Name | Condition | Return Value | |-----------|-----------|--------------| | Chinese Users | `country` = `CN` | Enabled | **PayPal Gate**: ``` Gate Name: paypal_enabled Display Name: PayPal Payment Gate Type: Permanent Gate Default Value: Disabled ``` **Rule Configuration**: | Rule Name | Condition | Return Value | |-----------|-----------|--------------| | International Users | `country` ≠ `CN` | Enabled | ### Code Implementation ```javascript // Get supported payment methods async function getSupportedPaymentMethods(userCountry) { const paymentMethods = []; // Check WeChat Pay const wechatPayEnabled = await sensorswave.getGateValue('wechat_pay_enabled', false); if (wechatPayEnabled) { paymentMethods.push({ id: 'wechat_pay', name: 'WeChat Pay', icon: '/icons/wechat.png' }); } // Check Alipay const alipayEnabled = await sensorswave.getGateValue('alipay_enabled', false); if (alipayEnabled) { paymentMethods.push({ id: 'alipay', name: 'Alipay', icon: '/icons/alipay.png' }); } // Check PayPal const paypalEnabled = await sensorswave.getGateValue('paypal_enabled', false); if (paypalEnabled) { paymentMethods.push({ id: 'paypal', name: 'PayPal', icon: '/icons/paypal.png' }); } return paymentMethods; } ``` ### Expected Results - Chinese users see WeChat Pay and Alipay - International users see PayPal - No need to maintain multiple versions of code ## Scenario 8: Rapid Issue Fix ### Business Scenario A bug is discovered in a feature in production and needs to be quickly disabled, then re-enabled after the fix. ### Solution Use a Feature Gate to quickly disable the problematic feature. ### Configuration Example **Feature Gate Configuration**: ``` Gate Name: new_user_profile_enabled Display Name: New User Profile Page Gate Type: Temporary Gate Default Value: Enabled (already fully released) ``` ### Issue Resolution Process **1. Issue Discovered** Users report that the new user profile page cannot load photos. **2. Quickly Disable the Feature** 1. Log in to the Sensors Wave console 2. Change the Feature Gate to disabled 3. Takes effect within 1 second; all users revert to the old page **3. Fix the Issue** ```javascript // Fix the bug in the code async function loadUserPhoto(userId) { try { const photo = await fetchUserPhoto(userId); return photo; } catch (error) { // Fix: add error handling and Fallback console.error('Failed to load photo:', error); return getDefaultPhoto(); } } ``` **4. Re-Release** 1. Deploy the fixed code 2. Re-enable the Feature Gate 3. Verify the issue is resolved ### Expected Results - Impact duration reduced from hours to minutes - No code rollback or redeployment needed - Minimal user experience impact ## Summary Feature Gates provide flexible control capabilities across different scenarios: | Scenario | Primary Value | Recommended Gate Type | |----------|--------------|----------------------| | Gradual Rollout of New Features | Reduce risk, progressive validation | Temporary Gate | | Feature Fallback Protection | Quick Fallback, ensure stability | Ops Gate | | Premium Feature Control | Permission management, dynamic effect | Permanent Gate | | User-Targeted Features | Precise targeting, personalized experience | Permanent Gate | | Seasonal Features | Scheduled toggle, no deployment needed | Temporary Gate | | A/B Test Pre-Stage | Separate technical risk from effectiveness verification | Temporary Gate | | Regional Customization | Regional adaptation, flexible configuration | Permanent Gate | | Rapid Issue Fix | Quick rollback, reduce impact | Temporary/Ops Gate | ## Next Steps Now that you understand typical Feature Gate use cases, you can: 1. **[Feature Gates vs A/B Tests](gates-vs-experiments.mdx)**: Dive deeper into the differences and how to combine them 2. **[Management and Monitoring](management-and-monitoring.mdx)**: Learn how to manage and monitor Feature Gates 3. **[Best Practices](best-practices.mdx)**: Master the best ways to use Feature Gates --- **Last updated**: January 28, 2026