Methods
clearExperimentOverride(experimentName)static
#
Clears all enrolment overrides for the experiment and reloads the page.
clearExperimentOverrides()static
#
Clears all experiment enrolment overrides for all experiments and reloads the page.
getAssignments() → {Object}static
#
Gets a map of experiment to group for all experiments that the current user is enrolled into.
This method is internal and should only be used by other Experimentation Lab components. Currently, this method is only used by [the Client Error Logging instrument in WikimediaEvents][0].
Returns:
- Type
- Object
Gets a map of experiment to group for all experiments that the current user is enrolled into.
getExperiment(experimentName) → {Experiment}static
#
Gets an mw.xLab.Experiment instance that encapsulates the result of enrolling the current
user into the experiment. You can use that instance to get which group the user was assigned
when they were enrolled into the experiment and send experiment-related analytics events.
Example
const e = mw.xLab.getExperiment( 'my-awesome-experiment' );
const myAwesomeDialog = require( 'my.awesome.dialog' );
[
'open',
'default-action',
'primary-action'
].forEach( ( event ) => {
myAwesomeDialog.on( event, () => e.send( event ) );
} );
// Was the current user assigned to the treatment group?
if ( e.isAssignedGroup( 'treatment' ) ) {
myAwesomeDialog.primaryAction.label = 'Awesome!';
}
Parameters:
| Name | Type | Description |
|---|---|---|
experimentName |
string | The experiment name |
Returns:
- Type
- Experiment
Gets an mw.xLab.Experiment instance that encapsulates the result of enrolling the current
user into the experiment.
getInstrument(instrumentName) → {}static
#
Creates a new
Instrument instance using config fetched from xLab.
overrideExperimentGroup(experimentName, groupName)static
#
Overrides an experiment enrolment and reloads the page.