Hi,
My subjects are asked to perform a task on my website and then they should fill a survey.
The hardest issue here is to synchronize the data, collected by my task (not related to psychopy), and the survey.
To perform an automatic data sync (by user id) I need to write a user’s id (that he receives on my website) to the survey database.
I’m wondering whether a psychopy survey can get subject id (created by my website) as a variable.
We will be supporting the use of variables in URL requests, yes, but that isn’t implemented at the moment. Note that this is just a proof of principle so far, with serious development due to begin soon.
Same issue here, don’t want to rely on participants typing in their correct ID
I’ve found a workaround that I want to share here, so people might be able to test and improve it. Please mind that I have not tested this solution under “real” conditions yet. However, so far it’s been working for me
You can get attributes from the URL as described here. Let’s say your URL is my_experiment.html, then you could add each participant’s ID by adding my_experiment.html/?id="[insert ID]"
Now you need to add a function to the index.html file to read the ID from the URL. There are many ways to do this, I’ve used this suggestion, because it was the simplest I came across.
Add the function at the beginning of the script where all the other functions are defined. Since I will only read attribute “id” from the URL, I’ve adjusted the function