Hello,
When using Lioness to conduct an experiment on mTurk, is the session-variable "externalID" supposed to be the mTurk workers ID? As far as we can see, it does not record this automatically, and the documentation does not mention it.
We would like to record the mTurk worker ID as a variable for an experiment that is soon to be conducted. This is because the payment for some of our workers in a few different experiments will depend on decisions of other workers in our main experiment at a later time, and we would like to extract the worker ID as a failsafe and for convenience when calculating the contingent payoffs to our participants in the first few experiments.
We have found that it is possible to add the worker ID to the URL's when workers accept our HIT on mTurk (by implementing the code in
this link). But (with our very limited programming experience) we struggle to find a way for Lioness to extract and record this.
By following the instructions in the link, the URL for mTurk workers will look something like:
https://example.com/.../_beginParticipant.php?workerID="workerID"Note that the URL will change from _beginParticipant.php?workerID="workerID" to stage12345.php (first stage), where the addition we made to end of the the URL dissappears. We have a javascript (see below) that is able to capture the workerID in the URL when we put it in a script on our first stage, but since the page has been redirected from _beginParticipant the stage the URL no longer contains the values we are looking for. If we manually manipulate the URL in the first stage, the value is recorded the way we want.
We have tried integrating the javascript in the file _begin.php (we put it right above the command location.replace that forwards participants to the first stage), but when testing the experiment on our server we were unable to start the experiment. It works again as soon as we remove our script.
Does anyone have experience with this or suggestions on how to approach our problem?
Best regards
Håvard
Here is the javascript we use:
let searchParams = new URLSearchParams(window.location.search);
searchParams.has('workerID'); // true
let workerID = searchParams.get('workerID');
record('workerID', workerID);