A set of prototypes that aim at growing Wikipedia readers.
- Prototypes are temporary, disposable, and not optimized
- Decoupled architecture for fast development: back-end PHP API endpoints deliver JSON over HTTP to front-end JavaScript & CSS applications
- API endpoints are stubs and can be tailored for a single feature
- User interfaces in Vue.js and Codex. The HTML output or cache is left untouched if possible
- One-time shared setup for metrics integration, user preferences, etc.
- Install MediaWiki through the local development quickstart
- Clone these repositories:
USERNAME= # Fill in your shell user name here
git clone ssh://${USERNAME}@gerrit.wikimedia.org:29418/mediawiki/skins/MinervaNeue skins/MinervaNeue
for extension in MobileFrontend MobileFrontendContentProvider MultimediaViewer ReaderExperiments; do
git clone "ssh://${USERNAME}@gerrit.wikimedia.org:29418/mediawiki/extensions/${extension}" "extensions/${extension}"
done- Add the following to
LocalSettings.php:
wfLoadExtensions( [
'MobileFrontend',
'MobileFrontendContentProvider',
'MultimediaViewer',
'ReaderExperiments'
] );
wfLoadSkin( 'MinervaNeue' );
$wgDefaultMobileSkin = 'minerva';
$wgLanguageCode = "en"; # You can set another language here
$wgMFMwApiContentProviderBaseUri = "https://$wgLanguageCode.wikipedia.org/w/api.php";
$wgReaderExperimentsApiBaseUri = $wgMFMwApiContentProviderBaseUri;
$wgGenerateThumbnailOnParse = false;Consider using Fresh to handle Node.js and/or npm.
This feature can be enabled in two ways:
- URL parameter (for testing) - append
?imageBrowsing=1to any article URL - Experiment assignment - users assigned to the treatment group via
ExperimentManager
Example with URL parameter: /wiki/Angkor_Wat?imageBrowsing=1
Notes:
- The URL parameter bypasses experiment gating for easy testing
- Without the URL parameter, the feature only loads for users in the experiment treatment group
The following instructions apply to the local development quickstart.
cd extensions/ReaderExperiments
composer update
composer fix # Auto-fix PHP
composer testcd extensions/ReaderExperiments
npm ci
npm run fix # Auto-fix JavaScript
npm run lintcomposer phpunit:entrypoint -- extensions/ReaderExperiments/tests/phpunit/cd extensions/ReaderExperiments
npm ci
npm run jestThis recipe sets up a full environment to develop instruments.
- Clone these repositories:
for extension in EventBus EventLogging EventStreamConfig TestKitchen WikimediaEvents; do
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/${extension}" "extensions/${extension}"
done- Install
EventLoggingdependencies:
cd extensions/EventLogging
composer update- Add the following to
LocalSettings.php:
# https://www.mediawiki.org/wiki/MediaWiki-Docker/Configuration_recipes/EventLogging#Event_Platform
wfLoadExtensions( [
'EventBus',
'EventLogging',
'EventStreamConfig',
'TestKitchen',
'WikimediaEvents'
] );
# EventBus
$wgEventServices = [
'*' => [ 'url' => 'http://eventlogging:8192/v1/events' ],
];
$wgEventServiceDefault = '*';
$wgEnableEventBus = 'TYPE_EVENT';
# EventLogging
# https://github.com/wikimedia/mediawiki-extensions-EventLogging/blob/master/devserver/README.md
$wgEventLoggingServiceUri = 'http://localhost:8192/v1/events';
$wgEventLoggingBaseUri = '/beacon/event';
# Wait 1 second before sending batches of queued events
$wgEventLoggingQueueLingerSeconds = 1;
# Disable events when running PHP tests
if ( defined( 'MW_PHPUNIT_TEST' ) ) {
$wgEnableEventBus = 'TYPE_NONE';
$wgEventLoggingServiceUri = false;
}
# Test Kitchen (FKA xLab)
# https://wikitech.wikimedia.org/wiki/Test_Kitchen/Local_development_setup#Install_TestKitchen_extension
$wgTestKitchenEnable = true;
$wgTestKitchenEnableExperiments = true;
$wgTestKitchenEnableExperimentOverrides = true;
$wgEventStreams = [
// Add custom streams here.
];
$wgTestKitchenExperimentStreamNames = array_keys( $wgEventStreams );- Spin up the events server:
cd extensions/EventLogging/devserver
npm install --omit=optional
npm run eventgate-devserver- Open another terminal window, cd to
devserverandtail -f events.json - Load a page like
http://localhost:4000/index.php/Eddie_Cochran - In the browser console, fire a test event:
mw.eventLog.submit(
'foo',
{
$schema: '/analytics/product_metrics/web/base/2.1.0',
action: 'test'
}
);- You should see the event JSON in
events.json
A/B tests live in the Test_Kitchen (FKA xLab) as experiments.
There are 3 layers where you can test an experiment:
- Local development environment - set up instrumentation, then use the HTTP headers method
- Beta cluster - override enrollment
- Production - override enrollment