JS client library updates to simplify the submitInteraction function
Updated JS client library to deal with the approach we have discussed regarding how to supplement events with the enrollment details and to simplify submitInteraction
- Added temporary code to support Growth Team (or others) populating
enrolledandassignedproperties as acustomcoordinator- At this time they are using both fragments (
experimentsandexperiment) because some active experiment was still running with the deprecated one. We will remove that code when that experiment finishes and onlyexperimentwill remain whilecoordinatoris supported
- At this time they are using both fragments (
- Now experiments populate all the enrollment details as interaction data when sending events. Client library just adds that interaction data to the event
- Some minor warnings related to documentation have been also addressed
- We no longer use the version of the schema to determine if the enrollment details must be included in the event
- As we discussed,
other_assignedproperty won't be populated by client libraries
This MR can be tested in several ways:
- Sending a regular event with no experimentation details
mw.eventLog.submitInteraction('product_metrics.web_base', '/analytics/product_metrics/web/base/1.3.1', 'hello')
- Sending an event with custom experimentation details using the old
experimentsfragmentmw.eventLog.submitInteraction('product_metrics.web_base', '/analytics/product_metrics/web/base/1.3.0', 'hello', { experiments: {enrolled: ['something'], assigned: { 'something': 'some_group' }}})
- Sending an event with custom experimentation details using the new
experimentfragmentmw.eventLog.submitInteraction('product_metrics.web_base', '/analytics/product_metrics/web/base/1.4.1', 'hello', { experiment: {enrolled: 'something', assigned: 'some_group', coordinator: 'custom'}})
There is a related change in the JS xLab SDK to make Experiment send enrollment details accordingly (it's already merged): https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MetricsPlatform/+/1136470
Once the patch above is merged, there is something else we can test regarding this one:
- Sending an event using an
Experimentinstance viasendmethod:const experiment = mw.xLab.getExperiment( 'mock-experiment' )experiment.send( 'something' )