Last active
April 17, 2018 13:07
-
-
Save polishdeveloper/dd42b2372218331c442e70e521e595ac to your computer and use it in GitHub Desktop.
Bucket yourself as anonymous user who can see PagePreviews on Wikipedia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to disable it just run
mw.storage.session.store['mwuser-sessionId'] = 0
and refresh the page