FeatureSignals

A/B Experimentation

FeatureSignals has built-in A/B experimentation support. Create flags with the ab type to assign users to weighted variants using consistent hashing.

Concepts

TermDescription
VariantOne arm of an experiment with a key, value, and weight
WeightRelative proportion in basis points (must sum to 10000)
ImpressionA record of a user seeing a specific variant

Configuring Variants

bash
curl -X PUT https://api.featuresignals.com/v1/projects/$PROJECT_ID/flags/checkout-experiment/environments/$ENV_ID \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "variants": [
      {"key": "control", "value": "original-checkout", "weight": 5000},
      {"key": "treatment-a", "value": "streamlined-checkout", "weight": 3000},
      {"key": "treatment-b", "value": "one-click-checkout", "weight": 2000}
    ]
  }'

How Assignment Works

  1. A hash bucket is computed from flagKey + "." + userKey (0–9999)
  2. Variants are walked in order, accumulating weights
  3. The first variant where bucket < cumulative_weight is assigned

Evaluating Variants

typescript
const variant = client.stringVariation(
  'checkout-experiment',
  { key: 'user-123' },
  'control'
);
// → "streamlined-checkout" or "original-checkout" or "one-click-checkout"

Tracking Impressions

bash
curl -X POST https://api.featuresignals.com/v1/track \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "flag_key": "checkout-experiment",
    "variant_key": "treatment-a",
    "user_key": "user-123"
  }'

Next Steps