Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bucket yourself as anonymous user who can see PagePreviews on Wikipedia
var sessId = 0,
bucket = 'off';
weightedBoolean = function getUserBucket( experiments, experimentGroupSize, sessionId ) {
const control = experimentGroupSize / 2;
if ( !experimentGroupSize ) {
return 'on';
}
return experiments.getBucket( {
name: 'ext.Popups.visibility',
enabled: true,
buckets: {
off: 1 - experimentGroupSize,
control,
on: control
}
}, sessionId );
};
while( bucket != 'on' ) {
sessId++;
var samplingRate = mw.config.get( 'wgPopupsAnonsExperimentalGroupSize', 0 );
bucket = weightedBoolean(
mw.experiments,
mw.config.get( 'wgPopupsAnonsExperimentalGroupSize' ),
sessId
);
console.log('For session ' + sessId + ' our bucket is ' + bucket);
}
mw.storage.session.store['mwuser-sessionId'] = sessId;
@niedzielski

This comment has been minimized.

Copy link

commented Apr 17, 2018

to disable it just run mw.storage.session.store['mwuser-sessionId'] = 0 and refresh the page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.