Feature Flag

Feature Flags let you roll out, control, and test new functionality in your product without deploying code changes. You can enable or disable features for specific users, cohorts, or environments directly in the Feature Management section of the platform.


Creating a Feature Flag

  1. Go to Analytics → Feature Management.
  2. Click Create New Feature.
  3. Provide a Name and optional Description.
  4. A unique Variant Key will be generated automatically (e.g., new_feature). Developers will use this key in code.

Defining Variations

Variations represent the possible values a feature flag can take.

  • Example (Boolean flag):

    • New Feature is ONtrue
    • New Feature is OFFfalse
  • You can also define custom values (string, number, JSON).

Set default variations for ON/OFF states — these are served when no other rule applies.


Targeting by Segments

Use the Segments tab to define which users see which variation.

  • Build rules based on user attributes (e.g., email contains @eucera or @foldspace).
  • Combine rules with AND / OR logic.
  • On match → select which variation to serve.

This allows you to progressively roll out features to internal users, beta testers, or specific customer accounts.


Gradual Rollout

Feature Flags allow you to roll out changes progressively instead of enabling them for all users at once. This helps reduce risk and validate performance before a full launch.

How to configure a rollout

  1. Open your feature flag in Feature Management.

  2. Go to the Segments tab.

  3. Create a New Rule (e.g., target all users or a specific segment).

  4. In the On match serve section, choose Rollout.

  5. Set percentages for each variation:

    • Example:
      • 10% → New Feature is ON
      • 90% → New Feature is OFF
  6. Save and publish the flag.

Adjusting rollout over time

  • Start small (e.g., 5–10%) to test stability.
  • Increase gradually as confidence grows (e.g., 25% → 50% → 100%).
  • Use Reports / Session Replay / Analytics to monitor impact at each stage.
  • Roll back instantly by setting 0% ON if an issue arises.

Example

VariationRollout %
New Feature is ON25%
New Feature is OFF75%

Best practice: Always combine gradual rollout with targeting rules. For example:

  • Start with internal emails (@eucera, @foldspace) at 100% ON.
  • Then expand to a small percentage of external users.
  • Scale up until the feature reaches 100% for everyone.

Testing a Feature

Use the Test Feature tab to validate rules before publishing:

  1. Enter a test user (e.g., by email).
  2. The system will show which variation would be served if the flag is ON or OFF.
  3. Check results for different attributes to confirm targeting logic.

This ensures rules and rollouts work as expected before release.


History & Auditing

Every Feature Flag includes a History tab that records all changes made to it. This provides a full audit trail for accountability and troubleshooting.

What gets recorded

  • Who made the change (user identity).
  • When the change was made (timestamp).
  • What was updated (e.g., new rule added, variation changed, targeting updated).
  • Before/after values in JSON format for precise comparison.

Best Practices

  • Start internal: first target employees or test accounts.
  • Gradual rollout: use percentage-based or cohort-based release before going wide.
  • Use meaningful names: new_feature, new_onboarding_flow, ai_summary_feature.
  • Always test: confirm the right users see the right variation before publishing.
  • Monitor history: roll back quickly if issues occur.

Implementing Feature Flag

In Code (Developer):

  • Query the flag value by its Variant Key (e.g., new_feature).
  • Wrap product logic to enable/disable based on the value.
  • The second argument (boolean) is the default value to fall back on if the server cannot be reached.

JavaScript Example

// Query a feature flag
let result = euceraClient.getVariant("new_feature", false);

// Use the result
if (result) {
  // Feature is ON
  enableNewFeatureUI();
} else {
  // Feature is OFF
  fallbackToDefault();
}

React Example

function MyComponent() {
  const [isNewFeatureOn, setNewFeatureOn] = React.useState(false);

  React.useEffect(() => {
    const value = euceraClient.getVariant("new_feature", false);
    setNewFeatureOn(value);
  }, []);

  return (
    <div>
      {isNewFeatureOn ? (
        <NewFeatureWidget />
      ) : (
        <LegacyWidget />
      )}
    </div>
  );
}

Testing Locally

Admins can use the Test Feature tab in Studio to simulate what values your code will receive. As a developer, you can also temporarily override flags in your local environment:

// Force-enable for testing
let result = euceraClient.getVariant("new_feature", true);