Background
How can the ClickThroughRateInstrument.js integrate with Experiment.js?
If Experiment has its own method send() for submitting events and CTR instrument uses submitInteraction(), including when you pass an Instrument to it – which Experiment does not appear to be a child of – so I don't think it's possible to write:const experiment = mw.xLab.getExperiment( 'my_experiment' ); if ( experiment.isEnrolled() ) { const { ClickThroughRateInstrument } = require( 'ext.wikimediaEvents.metricsPlatform' ); const ctrInstrument = ClickThroughRateInstrument.start( '[data-pinnable-element-id="vector-main-menu"] .vector-pinnable-header-unpin-button', 'pinnable-header.vector-main-menu.unpin', experiment ); }Am I missing something here?
Good catch.
We sorta lost track of this thread in between trying to deliver on SDS 2.4 (.11) and starting to discuss a vision for instrumentation 😅
In the interest of keeping the work we've already done/remaining consistent with what we've already shown other teams, I suggest that we take the shortest possible step of adding an Experiment#submitInteraction() method that:
- Proxies to Experiment#send()`
- Is documented as internal and unstable
In the long run though, I think that Click-through Rate Instrument should be moved into the MetricsPlatform extension and that WikimediaEvents should come to depend on that. I'm a little hazy on the path for this though – it might be entangled with Click-through Rate Instrument V2
This task covers the shortest possible step to make Experiment work with ClickThroughRateInstrument described above.
AC
- Add Experiment#submitInteraction() and make it proxy to #send()
- Document Experiment#submitInteraction() as internal and unstable
- Bump the default schema version to 1.4.2