A/B experiments (promos, offers). Developers only for the admin methods (403 otherwise); every change is audit-logged. The two create...ExperimentEvent methods are for the dashboard: report what the viewer saw and did, for the arm the server gave them (a mismatched or preview arm answers { recorded: false } and is not counted).

Constructors

Methods

  • "Make winner": everyone gets this variant from now on and the experiment ends. control = show nothing.

    Parameters

    • __namedParameters: {
          auth: string;
          key: string;
          variant: string;
      }
      • auth: string
      • key: string
      • variant: string

    Returns Promise<WebResponse<Experiment>>

  • Dashboard: a server-unit experiment event (promos). Needs access to the server.

    Parameters

    • __namedParameters: {
          auth: string;
          event: ExperimentEvent;
          guildId: string;
      }

    Returns Promise<WebResponse<{
        recorded: boolean;
    }>>

  • Results: per variant - exposures, clicks, conversions (adopt: the server turned the feature on within 7 days of first seeing it; buy: an attributed purchase within 14 days), revenue, conversion rate, lift and p-value vs control - plus likelyWinner (beats control at p < 0.05 with 200+ exposures each, or control when the promo hurts) and daily view / click / dismiss counts. Shown only: "Make winner" is still a staff click.

    Parameters

    • __namedParameters: {
          auth: string;
          key: string;
      }
      • auth: string
      • key: string

    Returns Promise<WebResponse<ExperimentResults>>

  • Dashboard: an "add this too" suggestion for the add-ons in the cart (addon ids, e.g. TiktokConnections), or null. Call when the cart changes. Accepting adds suggestAddon to the cart and sends pairOffer: key with the checkout; report click (accepted) / dismiss (no thanks) with createExperimentEvent. Do not send view.

    Parameters

    • __namedParameters: {
          addons: string[];
          auth: string;
      }
      • addons: string[]
      • auth: string

    Returns Promise<WebResponse<{
        suggestion: null | PairSuggestion;
    }>>

  • Dashboard: the feature promo for one surface of a server - home, banner or page:<feature> (0 or 1 card). The server records that it was shown (control included), so do NOT send a view event for promos; send click on the CTA and dismiss on the X (createGuildExperimentEvent). Pass attribution into checkout when the CTA buys.

    Parameters

    • __namedParameters: {
          auth: string;
          guildId: string;
          surface: string;
      }
      • auth: string
      • guildId: string
      • surface: string

    Returns Promise<WebResponse<{
        promos: PromoCard[];
    }>>

  • Dashboard: the logged-in person's discount offer banner, or null. The first call starts their window (endsAt is fixed from then on). Pass key as offer to the checkout (premium.createCheckoutSession body) - the server re-checks it. Report click / dismiss with createExperimentEvent; do not send view.

    Parameters

    • __namedParameters: {
          auth: string;
      }
      • auth: string

    Returns Promise<WebResponse<{
        offer: null | OfferCard;
    }>>

  • Surfaces, rule, variants, group / slice, priority. Once started, variant keys and weights, the group and the slice are locked (only config text, surfaces, rule and priority can change).

    Parameters

    • __namedParameters: {
          auth: string;
          experiment: {
              group?: null | string;
              priority?: number;
              surfaces?: string[];
              targetRule?: unknown;
              trafficFrom?: number;
              trafficTo?: number;
              variants?: ExperimentVariant[];
          };
          key: string;
      }
      • auth: string
      • experiment: {
            group?: null | string;
            priority?: number;
            surfaces?: string[];
            targetRule?: unknown;
            trafficFrom?: number;
            trafficTo?: number;
            variants?: ExperimentVariant[];
        }
        • Optionalgroup?: null | string
        • Optionalpriority?: number
        • Optionalsurfaces?: string[]
        • OptionaltargetRule?: unknown
        • OptionaltrafficFrom?: number
        • OptionaltrafficTo?: number
        • Optionalvariants?: ExperimentVariant[]
      • key: string

    Returns Promise<WebResponse<Experiment>>

  • Move an experiment between stages. rollout needs a percentage above 0. An ended experiment cannot restart.

    Parameters

    • __namedParameters: {
          auth: string;
          key: string;
          rolloutPct?: number;
          stage:
              | "live"
              | "beta"
              | "ended"
              | "draft"
              | "dev"
              | "rollout";
      }
      • auth: string
      • key: string
      • OptionalrolloutPct?: number
      • stage:
            | "live"
            | "beta"
            | "ended"
            | "draft"
            | "dev"
            | "rollout"

    Returns Promise<WebResponse<Experiment>>