FeaturesFeature Flags & A/B Tests

Feature Flags & A/B Tests

SaaS Tracker’s feature flag system is built on GrowthBook’s statistical engine. Flags can be used as:

  • Boolean flags — ship a feature to a percentage of users
  • Multivariate flags — return different string/number values per variant
  • A/B tests — track conversion metrics per variant using GrowthBook’s Bayesian stats

SDK usage

import { tracker } from "./tracker";
 
// Boolean flag
const isEnabled = await tracker.isFeatureEnabled("new-onboarding-flow");
 
// Get flag value (with fallback)
const variant = await tracker.getFeatureValue("checkout-cta", "default");
 
// Evaluate and track exposure
if (await tracker.isFeatureEnabled("ai-recommendations")) {
  tracker.track("feature_flag_exposure", {
    flag: "ai-recommendations",
    variant: "enabled",
  });
  // show AI recommendations
}

Creating a flag

  1. Go to Flags in the dashboard
  2. Click New flag
  3. Set the flag key (e.g. new-onboarding-flow)
  4. Configure rollout percentage or user segment targeting
  5. Save — the flag is immediately live

Rollout rules

Flags support these targeting rules (evaluated in order):

Rule typeExample
Percentage rollout20% of all users
User property filterplan = "growth"
User ID listSpecific user IDs for internal testing
Environmentenv = "production" only

A/B test metrics

  1. Create a flag with ≥ 2 variants
  2. In the Experiments page, connect the flag to a conversion event (e.g. upgrade_clicked)
  3. GrowthBook calculates lift and p-value daily

A/B tests need at least 100 exposures per variant before showing statistical results.

Config delivery

The SDK fetches flag state from GET /config on init and caches it for 60 seconds. You can force a refresh:

await tracker.refreshFlags();