psychopy.org | Reference | Downloads | Github

Trouble passing variables through URL

We are recruiting participants through SONA, sending them to QuestionPro survey, and then sending them to the pavlovia experiment. To automatically grant credits to participants on SONA, we are passing the randomly generated SONA id into the QuestionPro survey, and from the survey into the experiment.

We tested the procedure with the pilot token url of the experiment, and everything was working perfectly. However, when we set everything up with the actual running url, the sona id was not being passed from the QuestionPro survey into the experiment.

So, when using the pilot token, we added the following at the end of the url:

&id=${sn}&participant=1

  • “sn” is what the SONA id is called in QuestionPro
  • “id” is what the SONA id is called in the experiment

With the running url, we added the following at the end of it:

?id=${sn}&participant=1

I also tried adding “/” before “?”, but that did not work.

With the pilot token, it would actually store the id number in the data file. With the run url, it is storing “${sn}” in the data file.

Any idea why this is happening or how to fix this?

You should be able to tell whether it’s working or not by looking at the URL bar when you follow the link from QuestionPro. It sounds like {sn} isn't being translated so PsychoPy is storing the untranslated value. Double check what you might be doing differently between the pilot and final version in QuestionPro for retrieving the SONA id. ?id= is clearly working if {sn} is being stored.

Yeah, looking at the URL bar is how I am checking.

I just double-checked everything, and the only difference between the pilot url and the run url is the passing of the pilot token and the oauth token in the pilot url. Everything else is the same.

If they’re the same then PsychoPy won’t be getting the id when piloting either

you are right, I just tested it again using the pilot URL and it didn’t get the id. I guess it’s something with the QuestionPro system. Thank you!