If anyone has a canned script for assigning a completion code to participants who get all the way through an experiment, and if you would not mind sharing it with me, I’d be very grateful.
Participants recruited via Amazon’s Mechanical Turk need to put in a unique code on the MTurk site to get their payments. I have done this in Qualtrics where it is set up to generate a random number between 1 and some large number (e.g., 9,999,999) for each participant who completes the task.
A simple enough solution is to use JavaScript to generate a unique completion code at the top of your script and print a Text element with that code in the last trial of the experiment. The general idea takes the following form in your project’s script:
code = 'my unique completion code'
Sequence( "intro" , randomize("trials") , SendResults() , "end" )
newTrial("end",
newText( code ).print()
,
newButton().wait() // end = wait on this screen forever
)
code = undefined // make it harder to fetch the code by other means
I’ve tried using this for my own experiment, but I couldn’t find a way to log the code. At first, I thought I could do this by simply writing this code:
newText("display", "Your unique code is: " + Code).center().print()
,
getText("display").log()
But when I ctrl+F’ed the code that was shown on the screen when I took it, there were no matches in the results file. Is there a way to directly log the Code constant? Or better syntax in logging displays? Thank you!