Can I pass a list from Pavlovia to Qualtrics via URL?

URL of experiment: https://pavlovia.org/run/sxc1127/cued-task-switching/html/

(here’s also my psyexp code in case the link doesn’t work)
sara_task_switch_beh_psychopy.psyexp (211.8 KB)

Description of the problem:

(I am new to all this so apologies if this sounds silly)

I am trying to pass a list of words from Pavlovia to Qualtrics…I was hoping I could create a list during my experiment and then pass it onto Qualtrics via URL

Does anyone have an idea of how / if I can do it?

In the task I add the words to ‘adj_list’ in a certain order based on certain conditions (which are different for each participant - that’s why I need to create it every time) and then I pass it to Qualtrics using:

$“https://bhampsychology.eu.qualtrics.com/jfe/form/SV_bOUJhQD1hWDQhTf?PROLIFIC_PID="+expInfo[‘PROLIFIC_PID’]+"&adj_list=”+adj_list

but it doesn’t seem to work (participants do not see the list of words in the Qualtrics questionnaire)

In alternative I could create an excel, csv or txt file with the list, but is there someone with experience in chaining information between Pavlovia and Qualtrics who could advise me on how it would work (since I’d have a different file for each participant)?

Many thanks in advance! I really appreciate your help.

An update:
(URL of experiment: https://run.pavlovia.org/sxc1127/cued-task-switching/html )

I now changed the completion URL on Pavlovia because I managed to spot some of my errors, this time using the following url:

$“https://bhampsychology.eu.qualtrics.com/jfe/form/SV_bOUJhQD1hWDQhTf?PROLIFIC_PID="+expInfo[‘PROLIFIC_PID’]+"&PARTICIPANT_ID="+expInfo[‘participant’]+"&RAND_ID="+expInfo[‘RAND_ID’]+"&STUDY_ID="+expInfo[‘STUDY_ID’]+"&SESSION_ID="+expInfo[‘SESSION_ID’]+"&adj_list=”+adj_list

but again I failed to transfer the adj_list to Qualtrics (this time Qualtrics set the adj_list as ‘undefined’).

All the other ID variables were correctly transferred to Qualtrics (except for the Prolific ID which was set to ‘undefined’ too for some reason)

Any help is truly appreciated!

Hi

I’m sorry but I think you’ll need to pass each item in the list as a separate URL variable.

I see, thank you very much!

May I only ask you if this would be the correct way to pass the information?
(I am only including prolific ID and the list of words in the following example)

$“https://bhampsychology.eu.qualtrics.com/jfe/form/SV_bOUJhQD1hWDQhTf?PROLIFIC_PID="+expInfo[‘PROLIFIC_PID’]+"&adj_list0="+adj_list[0]+"&adj_list1="+adj_list[1]+"&adj_list2="+adj_list[2]+"&adj_list3="+adj_list[3]+"&adj_list4="+adj_list[4]+"&adj_list5=”+adj_list[5]

where adj_list is first created at the beginning of the experiment like this: adj_list = [];
and then words appended throughout trials using: adj_list.push(word);

Apologies if these are silly questions but I am new to both js coding and Pavlovia. Thank you!

That looks right to me.

Hi @wakecarter,

thank you.
I tried passing the words as separate variables but I am getting an error when trying to sync my newly edited task to Pavlovia (I only changed the completion URL):
RecursionError: maximum recursion depth exceeded while calling a Python object (see screenshot below)

Might this be because the elements I take for the completion URL (adj_list[0], adj_list[1], etc…) do not exist since they are created later on in the experiment?
Or could it be that my URL is too long / is passing too many variables? I am trying to pass 100 words…

Apologies for bothering you again with this, many thanks for your help.

Here’s the psyexp file: sara_task_switch_beh_psychopy.psyexp (215.9 KB)

Sorry – my mistake. The completed URL can only contain expInfo variables. To add variables later you need to redirect using

Try with a short list of just a few words before going for the whole thing.

Great, thank you for the heads up.
So I could for example set my completion URL in the experiment settings tab just as:

$"https://bhampsychology.eu.qualtrics.com/jfe/form/SV_bOUJhQD1hWDQhTf?PROLIFIC_PID="+expInfo['PROLIFIC_PID']

and then add the following code in a code component in the “End Experiment” tab?

psychoJS.setRedirectUrls('$"https://bhampsychology.eu.qualtrics.com/jfe/form/SV_bOUJhQD1hWDQhTf?PROLIFIC_PID="+expInfo['PROLIFIC_PID']+"&adj_list0="+adj_list[0]+"&adj_list1="+adj_list[1]+"&adj_list2="+adj_list[2]', '$"https://bhampsychology.eu.qualtrics.com/jfe/form/SV_bOUJhQD1hWDQhTf?PROLIFIC_PID="+expInfo['PROLIFIC_PID']')

Do I remove the $ sign or do I write the urls exactly as I would write them in the experiment settings?

You don’t need the $ in the code component and I wouldn’t bother having it in the completed URL. You may as well start with a completed URL of just https://bhampsychology.eu.qualtrics.com/jfe/form/SV_bOUJhQD1hWDQhTf and add all the variables in the redirection.

Personally I’d put it in Begin Routine of the final routine just in case End Experiment is too late.

Thank you for the suggestions.
I’ve now set the starting URL as you suggested, then in Begin Routine of a code component towards the end of the experiment I’ve set the JS code to be something like:

psychoJS.setRedirectUrls(((((((('https://bhampsychology.eu.qualtrics.com/jfe/form/SV_bOUJhQD1hWDQhTf?PROLIFIC_PID=' + expInfo['PROLIFIC_PID']) + '&adj_list0=') + adj_list[0])+ '&adj_list1=') + adj_list[1])+ '&adj_list2=') + adj_list[2]), 'https://bhampsychology.eu.qualtrics.com/jfe/form/SV_bOUJhQD1hWDQhTf');

this syncs correctly when I only pass few words like in this example above, but it gives me the following errors when I populate the function with all the 100 words I need:

  • RecursionError: maximum recursion depth exceeded
  • AttributeError: ‘RecursionError’ object has no attribute ‘message’

I checked the syntax (having such a long function becomes error-prone, but I checked and it should have the correct number of brackets etc…), but it seems like after a certain number of variables that error appears…any suggestion on what else I could try or how to fix it?

psyexp file attached: sara_task_switch_beh_psychopy.psyexp (225.1 KB)

Why do you need to pass 100 words to Qualtrics?

Another option would be to pass the list as a single delimited string and then split it in Qualtrics using JavaScript.