Skip to content

Commit

Permalink
Merge pull request #1 from JWMarchant/stats-support
Browse files Browse the repository at this point in the history
Added in stats support
  • Loading branch information
JWMarchant committed Feb 3, 2016
2 parents 7f778bf + 6cb6521 commit 46c553b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions optimizely.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,24 @@ public function get_experiment_results( $experiment_id, $options = array() ) {
) );
}// end get_experiment_results

/**
* Get the top-level results (stats) of an experiment, including number of visitors,
* number of conversions, and chance to beat baseline for each variation.
*/
public function get_experiment_stats( $experiment_id, $options = array() ) {
// @TODO: support options
// @TODO: check for 503 in case this endpoint is overloaded (from docs)
$extra = '';
if ( $options ) {
$extra = '?' . http_build_query( $options );
}//end if

return $this->request( array(
'function' => 'experiments/' . abs( intval( $experiment_id ) ) . '/stats' . $extra,
'method' => 'GET',
) );
}// end get_experiment_results

/**
* Creates a new experiment
*/
Expand Down

0 comments on commit 46c553b

Please sign in to comment.