Skip to content

Guides

Feature flags and experiments

Create feature flags, roll out gradually, read payloads and run A/B tests with the Tracklyne SDKs.

Create a flag

In Feature flags → New flag choose a key (for example new-onboarding), then add release groups: property filters and a rollout percentage. A user matches the first group whose filters all match and who falls inside the rollout.

For a multivariate flag, add variants with their share (for example control 50% and test 50%), and optionally a JSON payload per variant.

Use it in code

app.ts
if (tracklyne.isFeatureEnabled("new-onboarding")) {
  showNewOnboarding();
}

const variant = tracklyne.getFeatureFlag("pricing-test");         // "control" | "test"
const payload = tracklyne.getFeatureFlagPayload("pricing-test");  // { price: 19 }

tracklyne.onFeatureFlags(() => render()); // flags loaded or changed

Avoid a flash of the old UI by bootstrapping flags from your server render: pass bootstrap: { distinctId, featureFlags } to init.

Run an experiment

  1. Create an experiment, which creates its multivariate flag.
  2. Pick a goal: a funnel conversion, a trend or a property sum, plus optional secondary metrics.
  3. Ship code that branches on the flag value. Exposure is recorded with $feature_flag_called.
  4. Tracklyne shows the probability of each variant to be best and tells you when the result is significant. Ship the winner by rolling its value out to 100%.