SDK Concepts

FlagSync SDKs enable feature management across platforms:

User Context Best Practices

When defining the user context for flag evaluations, always provide a unique and persistent key in the FsUserContext object to ensure accurate billing and consistent flag behavior:

  • Billing Impact: FlagSync tracks monthly active users (MAUs) based on unique key values, which are limited by your pricing tier. Non-unique or non-persistent keys (e.g., hardcoding 'anonymous' or generating a new ID per request) can undercount or overcount MAUs, affecting billing accuracy.
  • Functionality Impact: During percentage rollouts, FlagSync uses the user context for deterministic hashing to ensure the same user receives consistent flag values across sessions. Non-persistent keys cause inconsistent flag evaluations, disrupting rollout behavior.

Avoid hardcoding key values like 'anonymous' or generating a new ID on every request (e.g., calling nanoid() without persistence). Instead, use a persistent identifier, such as a cookie for unauthenticated users (e.g., visitor-id), to ensure accurate MAU tracking and consistent flag evaluations.