View Source GrowthBook.Experiment (GrowthBook v0.3.0)

Struct holding Experiment configuration.

Holds configuration data for an experiment.

Link to this section Summary

Types

t()

Experiment

Variation

Functions

Creates new experiment struct from rule.

Link to this section Types

Specs

t() :: %GrowthBook.Experiment{
  active?: boolean() | nil,
  bucket_version: integer() | nil,
  condition: GrowthBook.Condition.t() | nil,
  coverage: float() | nil,
  disable_sticky_bucketing: boolean() | nil,
  fallback_attribute: String.t() | nil,
  filters: [GrowthBook.Filter.t()] | nil,
  force: integer() | nil,
  hash_attribute: String.t() | nil,
  hash_version: integer() | nil,
  key: String.t(),
  meta: [GrowthBook.VariationMeta.t()],
  min_bucket_version: integer() | nil,
  name: String.t() | nil,
  namespace: GrowthBook.namespace() | nil,
  parent_conditions: [GrowthBook.ParentCondition.t()] | nil,
  phase: String.t() | nil,
  ranges: [GrowthBook.BucketRange.t()],
  seed: String.t() | nil,
  variations: [variation()],
  weights: [float()]
}

Experiment

Defines a single Experiment. Has a number of properties:

  • key (String.t/0) - The globally unique identifier for the experiment
  • variations (list of variation/0) - The different variations to choose between
  • weights (list of float/0) - How to weight traffic between variations. Must add to 1.
  • active? (boolean/0) - If set to false, always return the control (first variation)
  • coverage (float/0) - What percent of users should be included in the experiment (between 0 and 1, inclusive)
  • ranges (list of GrowthBook.BucketRange.t/0) - Array of ranges, one per variation
  • condition (GrowthBook.Condition.t/0) - Optional targeting condition
  • namespace (GrowthBook.namespace/0) - Adds the experiment to a namespace
  • force (integer/0) - All users included in the experiment will be forced into the specific variation index
  • hash_attribute (String.t/0) - What user attribute should be used to assign variations (defaults to id)
  • fallback_attribute (String.t/0) - When using sticky bucketing, can be used as a fallback to assign variations
  • hash_version (integer/0) - The hash version to use (default to 1)
  • meta (list of GrowthBook.VariationMeta.t/0) - Meta info about the variations
  • filters (list of GrowthBook.Filter.t/0) - Array of filters to apply
  • seed (String.t/0) - The hash seed to use
  • name (String.t/0) - Human-readable name for the experiment
  • phase (String.t/0) - Id of the current experiment phase
  • disable_sticky_bucketing (boolean/0) - If true, sticky bucketing will be disabled for this experiment. (Note: sticky bucketing is only available if a StickyBucketingService is provided in the Context)
  • bucket_version (integer/0) - An sticky bucket version number that can be used to force a re-bucketing of users (default to 0)
  • min_bucket_version (integer/0) - Any users with a sticky bucket version less than this will be excluded from the experiment
  • parent_conditions (list of GrowthBook.ParentCondition.t/0) - Optional parent conditions

Specs

variation() :: number() | String.t() | map()

Variation

Defines a single variation. It may be a map, a number of a string.

Link to this section Functions

Link to this function

from_rule(feature_id, rule)

View Source

Specs

from_rule(String.t(), GrowthBook.FeatureRule.t()) :: t()

Creates new experiment struct from rule.