Skip to content
This repository was archived by the owner on Sep 28, 2023. It is now read-only.
This repository was archived by the owner on Sep 28, 2023. It is now read-only.

Define a type property and value when creating an experiment #12

@jaredcobb

Description

@jaredcobb

A recent change to the required properties on the Experiment JSON object has broken the ability to create experiments. See https://developers.optimizely.com/x/rest/v2/#Experiment_ there is now a property named type that is required and the plugin doesn't take this into account.

The experiment data payload is defined here

// Build the data array for the experiment.
$experiment = array(
'metrics' => array(
array(
'aggregator' => 'unique',
'event_id' => absint( $event_id ),
'scope' => 'visitor',
),
),
'name' => sprintf(
/* translators: 1: post ID, 2: post title */
esc_html__(
'WordPress [%1$d]: %2$s',
'optimizely-x'
),
absint( $post->ID ),
esc_html( $post->post_title )
),
'project_id' => absint( $project_id ),
'status' => 'paused',
'variations' => $this->generate_variations(
$variations,
$targeting_id,
$post
),
);
and needs to add the type property. The value should be defined based on how many variations were created by the user.

Three or fewer variations should be an a/b value (2 variations and the original) else it should be multivariate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions