Experiment JS Client Documentation - v1.16.1
    Preparing search index...

    Interface ExperimentConfig

    interface ExperimentConfig {
        analyticsProvider?: ExperimentAnalyticsProvider;
        automaticExposureTracking?: boolean;
        automaticFetchOnAmplitudeIdentityChange?: boolean;
        debug?: boolean;
        exposureTrackingProvider?: ExposureTrackingProvider;
        fallbackVariant?: Variant;
        fetchOnStart?: boolean;
        fetchTimeoutMillis?: number;
        flagConfigPollingIntervalMillis?: number;
        flagsServerUrl?: string;
        httpClient?: HttpClient;
        initialFlags?: string;
        initialVariants?: Variants;
        instanceName?: string;
        pollOnStart?: boolean;
        retryFetchOnFailure?: boolean;
        serverUrl?: string;
        serverZone?: string;
        source?: Source;
        throwOnError?: boolean;
        userProvider?: ExperimentUserProvider;
    }
    Index

    Properties

    analyticsProvider?: ExperimentAnalyticsProvider

    Provides a analytics implementation for standard experiment events generated by the client (e.g. ExposureEvent).

    Use exposureTrackingProvider instead

    automaticExposureTracking?: boolean

    If true, automatically tracks exposure events though the ExperimentAnalyticsProvider. If no analytics provider is set, this option does nothing.

    automaticFetchOnAmplitudeIdentityChange?: boolean

    This config only matters if you are using the amplitude analytics SDK integration initialized by calling Experiment.initializeWithAmplitudeAnalytics().

    If true, the ExperimentClient will automatically fetch variants when the user's identity changes. The user's identity includes user_id, device_id and any user properties which are set, unset or clearAlled via a call to identify().

    Note: Non-idempotent identify operations setOnce, add, append, and prepend are not counted towards the user identity changing.

    debug?: boolean

    Debug all assignment requests in the UI Debugger and log additional information to the console. This should be false for production builds.

    exposureTrackingProvider?: ExposureTrackingProvider

    Provides the ability to track exposure events through a 3rd party analytics implementation.

    fallbackVariant?: Variant

    The default fallback variant for all ExperimentClient.variant calls.

    fetchOnStart?: boolean

    Explicitly enable or disable calling fetch() on start():

    • true: fetch will always be called on start.
    • false: fetch will never be called on start.
    • undefined: fetch will always be called on start.
    fetchTimeoutMillis?: number

    The request timeout, in milliseconds, when fetching variants.

    flagConfigPollingIntervalMillis?: number

    The interval to poll local evaluation flag configurations on start(). Only used if pollOnStart is true. Minimum 60000.

    flagsServerUrl?: string

    The domain to request flag configurations used in local evaluation from.

    httpClient?: HttpClient

    (Advanced) Use your own http client.

    initialFlags?: string

    Initial values for flags. This is useful for bootstrapping the client with fallbacks for flag configs.

    initialVariants?: Variants

    Initial values for variants. This is useful for bootstrapping the client with fallbacks and values evaluated from server-side rendering.

    Variants

    instanceName?: string

    The name of the instance being initialized. Used for initializing separate instances of experiment or linking the experiment SDK to a specific instance of the amplitude analytics SDK.

    pollOnStart?: boolean

    Enable or disable local evaluation flag configuration polling on start().

    retryFetchOnFailure?: boolean

    Set to true to retry fetch requests in the background if the initial requests fails or times out.

    serverUrl?: string

    The domain from which to request variants using remote evaluation.

    serverZone?: string

    The amplitude data center to fetch flags and variants from. If set, automatically sets the serverUrl and flagsServerUrl configurations.

    source?: Source

    Determines the primary source of variants and variants before falling back.

    Source

    throwOnError?: boolean

    When set to true, the client will throw errors if requests fail for any reason (including timeouts, network errors, or server errors), rather than silently handling the error. This applies to both the initial fetch during start() and subsequent fetch() calls. Background retries will still be started if configured via retryFetchOnFailure.

    When false (default), errors are handled silently and retries may occur in the background based on the retryFetchOnFailure configuration.

    userProvider?: ExperimentUserProvider

    Sets a user provider that will inject identity information into the user for fetch() requests. The user provider will only set user fields in outgoing requests which are null or undefined.

    See ExperimentUserProvider for more details