How to conditionally end an online experiment in PsychoPy with Pavlovia surveys

Hello @Angelika

Here is my solution to this problem. Note that I don’t check the age of a participant, but whether they agree to the GDPR statement.

Here are the two routines

demo is in PsychoPy the embedded survey, getDemo is the routine to get the values from the demo survey. It contains a JavaScript only code component.

In Begin Experiment I initialize a couple of variables.

VPn = " ";
VPCode = " ";
zuStimmung = " ";

In Begin Routine I query the values from the embedded survey

VPn = expInfo["participant"];
surveyResp = demo.getResponse();
VPCode = surveyResp["VP-Code"];

zuStimmung = surveyResp["ZustimmungDatenschutz"];

if ((zuStimmung === "FALSE")) {
    quitPsychoJS('Vielen Dank für Ihr Interesse', false);
    psychoJS.setRedirectUrls("https://www.uni-muenster.de/Psychologie/", "https://www.uni-muenster.de/Psychologie/");
}

I check the value of zuStimmung and abort the experiment if its value is FALSE. Upon exiting, I redirected the participant to the institute’s website regardless of whether the experiment was completed or not completed.

I hope that helps.

Best wishes Jens