FIRExperimentController

class FIRExperimentController : NSObject

This class is for Firebase services to handle experiments updates to Firebase Analytics. Experiments can be set, cleared and updated through this controller.

  • Returns the FIRExperimentController singleton.

    Declaration

    Swift

    class func sharedInstance() -> FIRExperimentController
  • Updates the list of experiments. Experiments already existing in payloads are not affected, whose state and payload is preserved. This method compares whether the experiments have changed or not by their variant ID. This runs in a background queue.

    Declaration

    Swift

    func updateExperiments(withServiceOrigin origin: String, events: FIRLifecycleEvents, policy: Any!, lastStartTime: TimeInterval, payloads: [Data])

    Parameters

    origin

    The originating service affected by the experiment, it is defined at Firebase Analytics FIREventOrigins.h.

    events

    A list of event names to be used for logging experiment lifecycle events, if they are not defined in the payload.

    policy

    The policy to handle new experiments when slots are full.

    lastStartTime

    The last known experiment start timestamp for this affected service. (Timestamps are specified by the number of seconds from 00:00:00 UTC on 1 January 1970.).

    payloads

    List of experiment metadata.

  • Returns the latest experiment start timestamp given a current latest timestamp and a list of experiment payloads. Timestamps are specified by the number of seconds from 00:00:00 UTC on 1 January 1970.

    Declaration

    Swift

    func latestExperimentStartTimestampBetweenTimestamp(_ timestamp: TimeInterval, andPayloads payloads: [Data]) -> TimeInterval

    Parameters

    timestamp

    Current latest experiment start timestamp. If not known, affected service should specify -1;

    payloads

    List of experiment metadata.