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

0 votes

HI,

I would like to publish my survey on MTurk and therefore, I need an individual code generated at the end of my survey.
I read through this question https://support.soscisurvey.de/?qa=38/how-can-generate-mturk-completion-code-at-the-end-of-my-survey and I considered the other help pages for placeholders, random generators and value().
So far, I created a random generator variable (E202) and a text element (E203) and one page between the last "normal" and the official end page. On this page, I included my code:

question('E202');  // Random generator variable
// To stop when no codes are available anymore
if (value('E202_CP') > 0) {
  text('quotafull');
  buttonHide();
  pageStop();
}
// Defining the code variable and saving codes in it
$code = value('E202'); 
// Prepare a placeholder 
replace('%code%', 'E202', 'response');
// this placeholder is used in the text element below
question('E203');  // MTurk Code

When I now click through the survey, it just skips the new page.
If I put the code on the last "normal" page, it displays the text element (E203), but does not include a code from the generator. Same problem if I put the first rows of the code on the first page and only E203 on the last (not end) page...

Can you please tell me where the error is?

THANK YOU!

in SoSci Survey (English) by s110399 (115 points)
edited by SoSci Survey
The chapter on this has not yet been translated, but you may give Google Translate a try: https://www.soscisurvey.de/help/doku.php/de:create:vouchers

> If I put the code on the last "normal" page, it displays the text element (E203), but does not include a code from the generator.

Could you please add the debug information from this page to you question? Thanks. https://www.soscisurvey.de/help/doku.php/en:create:debugging
So, I read the chapter you sent and created the codes with Seriennummern and saved them in my random variable (E202). Unfortunately, it is still not displaying the additional page.

These are the debug information from the page I added to the survey between the last "normal" and the end page, where it should show the MTurk number (text element: E203)

[Information]    Interview started (new case no. 883)
[Information]    Questionnaire Thesis_V1 from project thesis_ai_attitudes will be used
[Processing]    Create questionnaire page no. 12
[Content]    Create question E202
[Information]    The random generator E202 drew these codes: 18
[Information]    value("E202_CP") = 0
[Information]    value("E202") = 18
[Content]    Create question E203
[Information]    The following placeholders have been prepared:
%code% = (text) AW597458

Do you see where the problem is?
Ok, I tried it again, and it still does not work.
When I test the questionnaire starting from my last "normal" page, it shows the MTurk page with a generated code. That's perfect :)
BUT if I start the questionnaire from the beginning, it does not show the MTurk page, but goes from the last "normal" to the end page...
> %code% = (text) AW597458

That looks good so far. Does ths page with the debug information show E203 at all? You have probably some more text than just the code (placeholder)?

> BUT if I start the questionnaire from the beginning, it does not show ...

Please double-check the debug information. Is that complete or is there anything else? You can also start an interview in debug mode and when you're on the MTurk page, simply post the URL from the browser's address bar. Then I can check for possible problems in the HTML structure of the text element.
This is the debug information from the last "normal" page when I start from the last "normal" page:

[Information]    Interview started (new case no. 901)
[Information]    Questionnaire Thesis_V1 from project thesis_ai_attitudes will be used
[Processing]    Create questionnaire page no. 11
[Content]    Create question VI09
[Content]    Create question VI06

This is the debug information from the MTurk page (I get when I start from the last "normal" page:
[Information]    Interview number 898 is to be continued
[Information]    Questionnaire Thesis_V1 from project thesis_ai_attitudes will be used
[Information]    Retention period on page 11 has been 7 seconds
[Processing]    Reading answers from page 11
[Information]    Answer to VI06_01 = 8
[Information]    Answer to VI06_02 = 7
[Information]    Answer to VI06_03 = 8
[Information]    Answer to VI06_04 = 8
[Information]    Answer to VI06_05 = 8
[Information]    100% of the questions have been answered so far
[Processing]    Create questionnaire page no. 12
[Content]    Create question E202
[Information]    The random generator E202 drew these codes: 477
[Information]    value("E202_CP") = 0
[Information]    value("E202") = 477
[Content]    Create question E203
[Information]    The following placeholders have been prepared:
%code% = (text) YW957687

This is the debug information from the last "normal" page when I start from the first page:

[Information]    Interview number 899 is to be continued
[Information]    Questionnaire Thesis_V1 from project thesis_ai_attitudes will be used
[Information]    Retention period on page 11 has been 4 seconds
[Processing]    Reading answers from page 11
[Information]    Answer to VI06_01 = 7
[Information]    Answer to VI06_02 = 7
[Information]    Answer to VI06_03 = 7
[Information]    Answer to VI06_04 = 7
[Information]    Answer to VI06_05 = 7
[Information]    100% of the questions have been answered so far
[Information]    According to the previously set page order, page 8 [VI1] is shown
[Processing]    Create questionnaire page no. 8
[Content]    Show text Video D
[Content]    Create question VI02
[Content]    Create question VI03

I am sorry, but I do not know what should be wrong here... :(

How can I give you access to the debug version of the interview?
> This is the debug information from the last "normal" page ...

Obviously, different questions are displayed on this page, depending on where you start. In the first case, these are VI09 and VI06, in the second case they are VI02 and VI03. According to the debug information, I assume that a setPageOrder() was active here.

Now the interesting part: What is show in the debug information when you pressed "next" in the second case?
Hi,

yes, so the content on the last "normal" page is randomised. I used set page order to avoid material being shown twice when people refresh the page.

Last "normal" page when started from the beginning:

[Information]    Interview number 903 is to be continued
[Information]    Questionnaire Thesis_V1 from project thesis_ai_attitudes will be used
[Information]    Retention period on page 8 has been 4 seconds
[Processing]    Reading answers from page 8
[Information]    Answer to VI03_01 = 8
[Information]    Answer to VI03_02 = 8
[Information]    Answer to VI03_03 = 8
[Information]    Answer to VI03_04 = 8
[Information]    Answer to VI03_05 = 8
[Information]    100% of the questions have been answered so far
[Information]    According to the previously set page order, page 10 [VI3] is shown
[Processing]    Create questionnaire page no. 10
[Content]    Show text Video E
[Content]    Create question VI08
[Content]    Create question VI05

End page after starting in the beginning:
Here, it does not say anything about the random generator at all...

[Information]    Interview number 903 is to be continued
[Information]    Questionnaire Thesis_V1 from project thesis_ai_attitudes will be used
[Information]    Retention period on page 10 has been 46 seconds
[Processing]    Reading answers from page 10
[Information]    Answer to VI05_01 = 4
[Information]    Answer to VI05_02 = 4
[Information]    Answer to VI05_03 = 4
[Information]    Answer to VI05_04 = 4
[Information]    Answer to VI05_05 = 4
[Information]    100% of the questions have been answered so far
[Information]    According to the previously set page order, the last page of the questionnaire is shown
[Processing]    Create the questionnaire's last page

Last "normal" page starting from there:

[Information]    Interview started (new case no. 904)
[Information]    Questionnaire Thesis_V1 from project thesis_ai_attitudes will be used
[Processing]    Create questionnaire page no. 11
[Content]    Create question VI09
[Content]    Create question VI06

MTurk page after starting from last "normal" page:

[Information]    Interview number 904 is to be continued
[Information]    Questionnaire Thesis_V1 from project thesis_ai_attitudes will be used
[Information]    Retention period on page 11 has been 16 seconds
[Processing]    Reading answers from page 11
[Information]    Answer to VI06_01 = 8
[Information]    Answer to VI06_02 = 8
[Information]    Answer to VI06_03 = 8
[Information]    Answer to VI06_04 = 8
[Information]    Answer to VI06_05 = 8
[Information]    100% of the questions have been answered so far
[Processing]    Create questionnaire page no. 12
[Content]    Create question E202
[Information]    The random generator E202 drew these codes: 187
[Information]    value("E202_CP") = 0
[Information]    value("E202") = 187
[Content]    Create question E203
[Information]    The following placeholders have been prepared:
%code% = (text) KX825658

End page when starting from last "normal" page:

[Information]    Interview number 904 is to be continued
[Information]    Questionnaire Thesis_V1 from project thesis_ai_attitudes will be used
[Information]    Retention period on page 12 has been 21 seconds
[Processing]    Reading answers from page 12
[Information]    100% of the questions have been answered so far
[Processing]    Create the questionnaire's last page
[Information]    The following placeholders have been prepared:
%code% = (text) KX825658

1 Answer

+1 vote

Thanks for the debug information. I think this here is the explanation:

[Processing]    Reading answers from page 10
...
[Information]    According to the previously set page order, the last page of the questionnaire is shown

As you already noted, nothing about the rendom geneator shows up. Why? Because page 11 that contains the random generator is skipped by setPageOrder().

You have not yet posted the PHP code from the setPageOrder(), but I assume that you added 'end' to the page order (after doing the randomized paged), which is the goodbye page. Pleaseg ive page 11 an ID and add this ID instead of 'end'.

by SoSci Survey (68.1k points)
Hi, thank you so much! I changed 'end' to where it says 'MTURK' now. And it works :)

//06 CONTROL
// Video Rotation
if (!isset($video)) {

$video = array(
    'Video A', 'Video B', 'Video C', 'Video D', 'Video E'
);
shuffle($video);
put('VI11_01', $video[0]);
put('VI11_02', $video[1]);
put('VI11_03', $video[2]);
put('VI11_04', $video[3]);
put('VI11_05', $video[4]);
 registerVariable($video);

$i = loopPage(count($video));
text($video[0], 'align=center', 'spacing=30');

}

question('VI01');  // RATING1

// Page Rotation
if (!isset($pages)){
    $pages = array ('VI1', 'VI2', 'VI3', 'VI4');
    shuffle($pages);
put('VI10_01', $pages[0]);
put('VI10_02', $pages[1]);
put('VI10_03', $pages[2]);
put('VI10_04', $pages[3]);
    $pages[] = 'MTURK';
    registerVariable($pages);
}
setPageOrder($pages);
...