Before adding the ReaderExperiments extension to production, we need to take some additional steps to "gate" the ImageBrowsing prototype to a limited subset of users.
Requirements
Ensure that the Image Browsing code (at least the bulk of it, i.e. Vue.js and components) only loads when both of the conditions below are met:
- The user is on the minerva skin (we understand some Desktop users request this, but that number is negligible for our experiment)
- At least one of the following is true:
- The user has been bucketed into the experiment group for an active A/B test via xLab
- The user has manually enabled the Image Browsing feature via the correct URL parameter feature flag.
If these conditions are not met, the only impact our feature should have on visitors should be:
- An empty <div> has been added to article pages
- A small amount of JS (not Vue, Codex, or any UI components) has been loaded to test for whether the full UI needs to be displayed.
Open question: target wikis
In addition to the above conditions, the A/B test for ImageBrowsing will only be run on a subset of target wikis. It's actually not currently clear to me how this will be achieved:
- Will we enable the extension on all Wikipedias and then use xLab to limit the A/B testing (meaning that users with URL params on non-target Wikis could still see this feature if they were curious)?
- Or will we only enable the extension on the target wikis, meaning that users on other-language Wikipedias would have no way to see this? I could see this option being what we'd want if we are concerned about not having the UI sufficiently translated.
Open Question: Should opt-in users on Vector be supported?
If for some reason we wish to allow opt-in users on Vector to see this feature, we can probably accommodate that as long as there is an easy way within xLab to scope the experiment to Minerva skin only.
Implementation notes
- We currently add the ResourceModule containing the ImageBrowsing UI (CSS & JS plus messages, etc) to article pages in PHP. We need to modify this approach – we should define a new very small RL module that contains basic JS initialization code to test for the above conditions. If the conditions have been met, the full UI can be loaded from another RL module via mw.loader.using, mw.loader.load, etc. Only this first small module should be added to payloads for non-participating users.
QA notes
Please check the following things during QA:
- The Image Browing UI no longer shows up normally by default
- The ext.readerExperiments.imageBrowsing ResourceLoader module should not be loaded at all in this case; this can be tested by opening the browser console on a Wiki article page and running mw.inspect() – check to see if ext.readerExperiments.imageBrowsing is in the results (it would be listed near the top if so given its size).
- The Image Browsing UI does show up properly if the ?imageBrowsing=1 or imageBrowsing=true URL param is used AND the user is on Minerva skin
- The Image Browsing UI does not show up if the URL param is used but the user IS NOT on Minerva skin
Other behavior should be unchanged









