I am following a guide posted by another user on here that allows you to automatically generate a random participant number from Sona, and transfer it to Qualtircs, then to a Pavlovia experiment and then back to Sona to deliver credit.
The guide looks like this:
SONA → Qualtrics → Pavlovia → SONA
-and was found on this thread: SONA, Qualtrics, Pavlovia
(for some reason, I cannot attach it to this thread, but it can be found on this url)
Problem:
My experiment is broken up into two parts. Part 1 and Part 2. In the Completed URL section of Part 1, I have added the URL for Part 2, and participants are automatically directed there. How do I automatically push the participant’s number from Part 1 to Part 2?
it will look like this:
SONA → Qualtrics → Pavlovia Part 1 → Pavlovia Part 2 → SONA
^^ How do I push participant number from Part 1 to Part 2?
The error says this:
Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 1221, in onPavloviaSync
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/builder/builder.py”, line 719, in fileExport
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 73, in generateScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 242, in compileScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/scripts/psyexpCompile.py”, line 214, in _makeTarget
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/_experiment.py”, line 225, in writeScript
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/settings/init.py”, line 598, in writeExpSetupCodeJS
TypeError: str returned non-string (type NoneType)
Any idea what is wrong?
Question 2. Following that guide, should the “Participant” field be automatically filled in with the randomly generated participant number? when testing out the connection to Part 1, I noticed the field was blank still.
Hmm, good catch on the quotes. I am not getting any errors but it does not seem to be pushing the info between part 1 and part 2 still.
I have the following in the completed URL section for Part 1:
$“Rapid Holistic Perception Part 2 [PsychoPy]”+expInfo[‘participant’]
When the user is redirected to Part 2, the participant field shows and it is blank.
The problem now is that the id is not being pushed from Pavlovia to Sona. It looks like my Sona redirect URL looks different than the guide. Specifically it ends with: &survey_code=${e://Field/id}
This is what I have in the Completed url field: "https://sjsu.sona-systems.com/webstudy_credit.aspx?experiment_id=443&credit_token=d6f65722c6be41ac86612379c6c351cd&survey_code={e://Field/id}"+expInfo[‘participant’]
This is Qualtrics code and therefore has no place in the PsychoPy completed URL field. It doesn’t matter what the variable name is. You need to pass the value from Sona back to Sona.
I do not know enough about the actual coding and have to rely pretty heavily on the code and instructions in the guide and suggestions I get on here. Thanks so much for your help. Do you have any idea why its still not getting from Part 2 to back to Sona?
Yes. When I tested it, I tracked the participant number in the URL from Sona to Qualtrics, to part 1, to part 2. It is only when it is supposed to be passed from part 2 back to Sona that there is an error.
12574 is the practice number generated. As you can see in the picture, it is passed from Sona to qualtrics to part 1 to part 2. between part 2 and Sona there is a problem.
if I enter the URL and make the survey_code = to 12574, it works. As you can see in the images below. So for some reason, on part 2, survey_code=’+expInfo[‘participant’] is not working.
You could try pushing Pavlovia 2 to a random website (e.g. back to Pavlovia 1) just to check whether the survey code is appearing in the URL – we don’t see it whether the number is still there.