0 votes
in SoSci Survey (English) by s093160 (200 points)

Hi all,

I'm afraid I need some help as I'm very new to PHP. I will try to describe my issue clearly.

What I need: Halfway through the survey, participants will be redirected to a behavioural task on Pavlovia, parsing their prolific ID as 'participant' and the interview ID as 'token'. I need this token to later continue this interview; if I understood the information on the following link correctly: https://www.soscisurvey.de/help/doku.php/en:create:functions:redirect

What I tried: In my redirect link, the reference is always passed on (this would be 'r' in the link on pavlovia. It's the id token that is problematic and I tried a few different ways. The current version is that I attempt to get 'i' from the sosci URL bar with readget() by using a PHP function on an otherwise blank page in the 'compose questionnaire' area, see: https://www.soscisurvey.de/help/doku.php/en:create:functions:readget#readget.

What happens with this version is that the url after redirecting to pavlovia says: https://run.pavlovia.org/S4HRI/mlj_a2b/html/?participant=333333&token=%id%. In other words, it passes $id as a literal STRING instead of replacing it with the unique letter-number combination.

If, instead of 'i' I use casenumber or casetoken (https://www.soscisurvey.de/help/doku.php/en:create:functions:casetoken) in the link, it does pass as a number without having to use readget(), but this number does not work as a continue token when Pavlovia redirects back to the questionnaire at the end of the task (SoSci will show an error to the participant saying that the token is invalid).

Specifically:
- What is the token I need to be able to continue the survey directly after coming back from an external site?
- And if it is indeed the '&i=xxxxx' part of the url, how do I parse it?

TL;DR - The address bar of my survey has a php variable i. I need to grab this i and pass it on to Pavlovia.

1 Answer

+1 vote
by SoSci Survey (304k points)
selected by s093160
 
Best answer

Please try this redirect:

redirect('https://run.pavlovia.org/S4HRI/mlj_a2b/html/?participant=333333&token=%caseToken%');

The placeholder %caseToken% is predefined, and you need no workaround with readGET() or anything else. You would also be able to access the token via caseToken(), if necessary.

If you need to send another ID (prolific ID) to Pavlovia, and you have stored that token in XY01_01 (fie example), then your redirect would look like this:

redirect('https://run.pavlovia.org/S4HRI/mlj_a2b/html/?token=%caseToken%&participant='.value('XY01_01'));

Please note that the dot (.) is the operator to connect strings in PHP.

by s093160 (200 points)
That worked, thank you!

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

...