Skip to content

Instantly share code, notes, and snippets.

@polishdeveloper
Last active April 17, 2018 13:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polishdeveloper/dd42b2372218331c442e70e521e595ac to your computer and use it in GitHub Desktop.
Save polishdeveloper/dd42b2372218331c442e70e521e595ac to your computer and use it in GitHub Desktop.
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
Copy link

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