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
- Go to Flags in the dashboard
- Click New flag
- Set the flag key (e.g.
new-onboarding-flow) - Configure rollout percentage or user segment targeting
- Save — the flag is immediately live
Rollout rules
Flags support these targeting rules (evaluated in order):
| Rule type | Example |
|---|---|
| Percentage rollout | 20% of all users |
| User property filter | plan = "growth" |
| User ID list | Specific user IDs for internal testing |
| Environment | env = "production" only |
A/B test metrics
- Create a flag with ≥ 2 variants
- In the Experiments page, connect the flag to a conversion event (e.g.
upgrade_clicked) - 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();