Interface ExperimentDelegate


public interface ExperimentDelegate
This delegate is used to pass experiment information between the embedding application and GeckoView.

An experiment is used to give users different application behavior in order to learn and improve upon what features users prefer the most. This is accomplished by providing users different application experiences and collecting data about how the differing experiences impacted user behavior.

  • Method Details

    • onGetExperimentFeature

      @AnyThread @NonNull default GeckoResult<JSONObject> onGetExperimentFeature(@NonNull String feature)
      Used to retrieve experiment information for the given feature identification.

      A @param feature is the item or experience the experimented is about. For example, "prompt" or "print" could be a feature.

      The @return experiment information will be information on what the application should do for the experiment. This is highly context dependent on how the experiment was setup and is decided and controlled by the experiment framework. For example, a feature of "prompt" may return {dismiss-button: {color: "red", full-screen: true}} or "print" may return {dotprint-enabled: true}. That information can then be used to present differing behavior for the user.

      Parameters:
      feature - The name or identification of the experiment feature.
      Returns:
      A GeckoResult<JSONObject> with experiment criteria. Typically will have a value related to showing or adjusting a feature. Will complete exceptionally with ExperimentDelegate.ExperimentException if the feature wasn't found.
    • onRecordExposureEvent

      @AnyThread @NonNull default GeckoResult<Void> onRecordExposureEvent(@NonNull String feature)
      Used to let the experiment framework know that the user was shown the feature. Should be recorded as close as possible to the differing behavior.

      One important part of experimentation is knowing when users encountered an experiment surface or difference in behavior. Sending an exposure event is recording with the experiment framework that the user encountered a differing behavior.

      For example, if a user never encountered a @param feature "prompt", then the exposure event would never be recorded. However, if the user does encounter a "prompt", then the experiment framework needs a record that the user encountered the experiment surface.

      Parameters:
      feature - The name or identification the experiment feature.
      Returns:
      A GeckoResult<Void> will complete if the feature was found and exposure recorded. Will complete exceptionally with ExperimentDelegate.ExperimentException if the feature wasn't found.
    • onRecordExperimentExposureEvent

      @AnyThread @NonNull default GeckoResult<Void> onRecordExperimentExposureEvent(@NonNull String feature, @NonNull String slug)
      Used to let the experiment framework know that the user was shown the feature in a given experiment. Should be recorded as close as possible to the differing behavior.

      Use [onRecordExposureEvent], if there is no experiment slug.

      This API is used similarly to [onRecordExposureEvent], but when a specific feature was encountered. For example a @param feature may be "prompt" and a given @param slug may be "dismiss" or "confirm". This is used to indicate a specific experiment surface was encountered.

      Parameters:
      feature - The name or identification the experiment feature.
      slug - The name or identification of the specific experiment feature.
      Returns:
      A GeckoResult<Void> will complete if the feature was found and exposure recorded. Will complete exceptionally with ExperimentDelegate.ExperimentException if the feature wasn't found or not recorded.
    • onRecordMalformedConfigurationEvent

      @AnyThread @NonNull default GeckoResult<Void> onRecordMalformedConfigurationEvent(@NonNull String feature, @NonNull String part)
      Used to let the experiment framework send a malformed configuration event when the feature configuration is not semantically valid.
      Parameters:
      feature - The name or identification the experiment feature.
      part - An optional detail or part identifier to be attached to the event.
      Returns:
      A GeckoResult<Void> will complete if the feature was found and the event recorded. Will complete exceptionally with ExperimentDelegate.ExperimentException if the feature wasn't found or not recorded.