Methods
getAssignedGroup() → {string|null}
#
null}
#
Gets the group assigned to the user when they were enrolled in the experiment.
Returns:
- Type
-
string
|
null
- Implements:
- Source:
getStartDate() → {Date|null}
#
null}
#
Gets the UTC start date of the experiment.
Returns:
If the experiment is configured, the UTC start date of the experiment; null
otherwise
- Type
-
Date
|
null
- Implements:
- Source:
isAssignedGroup(…groups) → {boolean}
#
Gets whether the group assigned to the current user is one of the given groups.
Example
const e = mw.testKitchen.getExperiment( 'my-awesome-experiment' );
// Is the current user assigned A or B for the "My Awesome Experiment" experiment?
if ( e.isAssignedGroup( 'A', 'B' ) {
// ...
}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
groups |
string |
repeatable |
Returns:
- Type
- boolean
send(action, [interactionData], [contextualAttributes])
#
Sends an analytics event.
If the event sender is an experiment, then the event is decorated with experiment-related data
before it is sent. The experiment-related data are specified and documented in
the fragment/analytics/product_metrics/experiment schema fragment.
If per-event contextual attributes are passed via the contextualAttributes param, then they are
added to the event before it is sent.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
action |
string | The action that the user enrolled in this experiment took, e.g. "hover", "click" |
|
interactionData |
Object |
optional |
Additional data about the action that the user enrolled in the experiment took |
contextualAttributes |
Array.<string> |
optional |
Per-event contextual attributes |
- Inherited from:
- Implements:
- Source:
sendExposure()
#
Logs an exposure event with 2-tier deduplication.
- Implements:
- Source:
submitInteraction(action, [interactionData], [contextualAttributes])package
#
Submits an event related to this experiment.
This method makes Experiment compatible with the click-through rate implementation in the
ext.wikimediaEvents.testKitchen ResourceLoader module by proxying to
mw.testKitchen.ExperimentInterface#send. Calling this outside of Test Kitchen is not
supported.
If per-event contextual attributes are passed via the contextualAttributes param, then they are
added to the event before it is sent.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
action |
string | The action related to the submitted event |
|
interactionData |
Object |
optional |
Additional data |
contextualAttributes |
Array.<string> |
optional |
Per-event contextual attributes |
- Implements:
- Source:
- See:
use(instrumentation) → {mw.testKitchen.ExperimentInterface}
#
Uses the generic instrumentation to send analytics events for this experiment.
This method is chainable.
Parameters:
| Name | Type | Description |
|---|---|---|
instrumentation |
mw.testKitchen.GenericInstrumentation |
Returns:
- Implements:
- Source: