Jump to content

Metrics Platform/Overriding experiment enrollment

From Wikitech

For QA purposes, there are two ways to override the experiment enrollment assigned by the bucketing algorithm that MetricsPlatform extension runs. That way you can assign any specific value to any variant for the current user.

Note that this functionality is disabled by default. To enable it you will have to set $wgMetricsPlatformEnableExperimentOverrides to true.

Using a Javascript function

You can set any value for a given variant using the mw.metricsPlatform.overrideExperimentEnrollment function. For example, if you have an experiment called test-mediawiki-article-toc-exp with a homepage_module variant, you can set to true the value for that variant as follows:

mw.metricsPlatform.overrideExperimentEnrollment('test-mediawiki-article-toc-exp', 'homepage_module', true);

To revert all changes done by the previous function in one or several variants, after your QA process, you can just run:

mw.metricsPlatform.clearExperimentEnrollmentOverrides()

Passing a query parameter

You can also pass a query parameter in the URL to set any specific value for a variant of a given experiment.

The name of the query parameter must be mpo and the format to override a variant using this way is mpo=name_of_the_experiment:name_of_the_variant:the_value. For example, if we want to set to true the homepage_module variant of our test-mediawiki-article-toc-exp experiment when visiting https://es.wikipedia.org/wiki/Bicicleta, we must go to the following URL:

https://es.wikipedia.org/wiki/Bicicleta?mpo=test-mediawiki-article-toc-exp:homepage_module:true

To undo the overriden value, just visit the wiki without passing any mpo query parameter and the values assigned to any variant will be the ones that the MetricsPlatform extension has assigned while running the bucketing algorithm as usual.