+1 vote
in SoSci Survey (English) by s080681 (125 points)

Hello,
I am happy to use Soscsurvey. But I would like to use Amazon's mturk to recruit participants and don't know how to generate the unique completion code.

Mturk offer this option called "survey link", where people get the link to the survey and see a box where they need to enter a code to prove they have finished it and get paid. The code should be provided to them at the end of the soscisurvey questionnaire.
Is there a easy way to do this?
The codes are pre-generated and unique. What I need to do now is to present each participant with one of them after they finish all the questions.

Any suggestions how to do this?

Thank you in advance!

1 Answer

0 votes
by SoSci Survey (304k points)
edited by SoSci Survey

I'd recommend the random generator for this task. Fill in all the codes as content, and draw one code per interview. You should also check how often the random generator has been completes so far (that's an additional variable "...CP" in the data set for the random generator) to ensure that at least one new code was available.

To display the code, just use a placeholder. Here's a sample code if your random generator has the ID "RG01" and you use a placeholder %code% in your questionnaire (e.g. a text element):

question('RG01');  // You may as well drag the RG01 into the page (above)

// Stop right now, if no more codes are available
if (value('RG01_CP') > 0) {
  text('quotafull');
  buttonHide();
  pageStop();
}

// EITHER Prepare placeholder %code%
// and use this placeholder in some text element below the PHP code
replace('%code%', 'RG01', 'response');

// OR display the code immediately
html('<p>Your code is <strong>'.value('RG01', 'label').'</strong>.</p>');
by s080681 (125 points)
Thank you for your reply.

 I have created RG01 and saved all my codes there. I have created a text element "Code" and saved with %code%. What is mean by a placeholder? I want put the at the end. So, which page should I  put RG01? Where should I paste the given script/coding?

Again thanks a lot for your kind support!!
Best regards,
by SoSci Survey (304k points)
For details on placeholders see https://www.soscisurvey.de/help/doku.php/en:create:placeholders - if you put the code and (below) the text element "Code" on the last "normal" page of your questionnaire (you cannot put active content on the very "last page"), you should be fine.
by s080681 (125 points)
edited by SoSci Survey
I am sorry, I have did it but it is not working. Actually, I am a new user and little knowledge about this tool and about coding. Please help me as I am trying for a long time. It would be great if you log in and have a look. My ID: euv39115, Password: <snip>
Thanks a lot indeed.
by SoSci Survey (304k points)
Please do never post you password publicly online (and change your account's password as soon as possibly). Thank you. We will never login with a user's credentials, but can create an administrator login, if required. Plase also understand that we cannot do the coding for single projects, as there are more than 10.000 of them per years of them on our servers. If the code does not work as intended, please create a new question and describe what is (not) working exactly. Please also read this advice: https://www.soscisurvey.de/help/doku.php/en:create:filter-solving#detect_failures
by s080681 (125 points)
edited by s080681
Ok, I did not realize it was in public. I am very sorry. I have changed my password. Thank you very much.
by s080681 (125 points)
Hello, Finally I have solved the problem. It is perfectly working. Thank you very much!!
by s120097 (110 points)
Hi I am having the same issue, since I am a new user I am not sure how to proceed after creating the questions RG01. How did you solve this? could you please help me?
Thanks.
by SoSci Survey (304k points)
Solved by now? Your other question in the online supports says that it works :)
https://support.soscisurvey.de/?qa=12622/i-want-to-generate-the-unique-codes-for-mturk&show=12642#c12642
by s131273 (100 points)
Hello!

I am having the same issues as described above. So far, I have created the random generator question (labeled RG01 for the sake of consistency with this thread) and have inserted it in my questionnaire. Beneath RQ01 I have created a PHP box with the PHP code described above. However, for both options (placeholder option with %code% embedded in a text element below the PHP code element, and display code immediately option), the randomly generated code is not visible on the page of the survey.

I know that a random code number for RG01 is successfully being generated each time I test it (so that part is working successfully), but the code number itself is not visible for participants completing the survey.

The PHP code I have been trying to use, copied from the example above, is:

// Stop right now, if no more codes are available
if (value('RG01_CP') > 0) {
  text('quotafull');
  buttonHide();
  pageStop();
}

// Prepare placeholder %code%
// and use this placeholder in some text element below the PHP code
replace('%code%', 'RG01', 'response');

html('<p>YOUR UNIQUE SURVEY COMPLETION CODE FOR MTURK IS <strong>'.value('RG01', 'label').'</strong>.</p>');



The text element below this PHP code, on the same page of the survey, is:

Thank you for your participation in this study! YOUR UNIQUE SURVEY COMPLETION CODE FOR MTURK IS %code%



From this PHP code, the text visible to participants on the actual survey page is:

YOUR UNIQUE SURVEY COMPLETION CODE FOR MTURK IS .

Thank you for your participation in this study!

YOUR UNIQUE SURVEY COMPLETION CODE FOR MTURK IS


I have been trying to figure out a solution to make this work for several hours, and I appreciate your help with solving this issue!
Thanks!
by SoSci Survey (304k points)
Did you drag the question RG01 on the page above (!) the PHP code?

If yes, please kindly open a new question (you may use the "ask related question" button above), because the comments quickly get confusing :)

Please also post the complete debug information of that page in the new question.
by s131273 (100 points)
I figured out the problem!
For those who also encounter this issue in the future, this PHP code worked for me to display the RG01 code value on the survey page, so that it is visible to participants:

html('<p>Your code is <strong>'.value('RG01').'</strong>.</p>');
by SoSci Survey (304k points)
Please note that this will display only the number (internal code) drawn by the random generator. If you imported only numbers, and no strings (codes with letters), then this may be the correct solution.

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...