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 enrolled and assigned properties as a custom coordinator
    • At this time they are using both fragments (experiments and experiment) because some active experiment was still running with the deprecated one. We will remove that code when that experiment finishes and only experiment will remain while coordinator is supported
  • 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_assigned property 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 experiments fragment
    • mw.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 experiment fragment
    • mw.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 Experiment instance via send method:
    • const experiment = mw.xLab.getExperiment( 'mock-experiment' )
    • experiment.send( 'something' )

Bug: T390060, T390308

Edited by Santiago Faci

Merge request reports

Loading