How to link qualtrics to cognition.run, then back to qualtrics by participant ID #2573
-
Hi all, I have a question about how to identify participants across qualtrics and cognition.run. I plan to ask participants to complete a qualtrics form, then be redirected to cognition.run to finish the task. After finishing task in cognition.run, participants will be redirected back to qualtrics to answer some post-task questions. However, I don't know how to carry participants ID from qualtrics to cognition.run, then back to qualtrics. Could anyone help me to adress this problem? Best wishes, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @TaoJin000, you can pass the participant ID from Qualtrics to Cognition and back to Qualtrics again using URL query parameters. For instance, if your redirection link is "myexperiment.cognition.run", then you could pass the the ID to your Cognition task with "myexperiment.cognition.run?id=123abc". Then, in your Cognition task, you'll need to get the ID from the URL and store it in a variable. jsPsych has a convenience function for this called At the end of your Cognition task when you redirect to Qualtrics, you will again need to append the ID to the end of the link. So your jsPsych code will look something like this: const ppt_id = jsPsych.data.getURLVariable('id'); // get ID from URL
jsPsych.data.addProperties({id: ppt_id}); // store ID in the jsPsych data
const redirect_link = "https://www.myexperiment.qualtrics.com?id="+ ppt_id; // pass ID to Qualtrics task via URL Note that if either of your redirection links already include URL parameters, then the ID parameter would need to be preceded by an ampersand rather than the question mark, e.g. const redirect_link = "https://www.myexperiment.qualtrics.com?a=1&id="+ ppt_id; Finally, you would need to save the participant ID in your Qualtrics task as embedded data, which you can read more about on this Qualtrics support page. Does this work for you? Let us know if you have further questions. |
Beta Was this translation helpful? Give feedback.
Hi @TaoJin000, you can pass the participant ID from Qualtrics to Cognition and back to Qualtrics again using URL query parameters. For instance, if your redirection link is "myexperiment.cognition.run", then you could pass the the ID to your Cognition task with "myexperiment.cognition.run?id=123abc".
Then, in your Cognition task, you'll need to get the ID from the URL and store it in a variable. jsPsych has a convenience function for this called
jsPsych.data.getURLVariable
.At the end of your Cognition task when you redirect to Qualtrics, you will again need to append the ID to the end of the link. So your jsPsych code will look something like this: