public

Some code for doing simple A/B-type randomization for locally-hosted HITs on Amazon Mechanical Turk (MTurk)

  • Download Gist
randomization_in_HIT.html
Liquid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<script>
function rand(){
if (Math.random() > .5){
document.getElementById('boss').style.visibility="hidden";
} else {
document.getElementById('requester').style.visibility="hidden";
}
}
 
</script>
<p>What country are your from?</p>
<p><input type="radio" name="country" value="US" />US<br />
<input type="radio" name="country" value="India" />India<br />
<input type="radio" name="country" value="Other" />Other</p>
<div hidden="false" id="boss">
<h3>What percentage (between 0 and 100) of Employers in your home country would you estimate treat workers honestly and fairly?</h3>
<input type="text" id="real" name="real" /></div>
<div hidden="false" id="requester">
<h3>What percentage (between 0 and 100) of Mechanical Turk Requesters would you estimate treat workers honestly and fairly?</h3>
<input type="text" id="amt" name="amt" /></div>
<p><iframe height="1" onload="rand()"></iframe></p>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.