psychopy.org | Reference | Downloads | Github

Passing variable from PsychoJS/Pavlovia to Qualtrics? (Not participant ID)

Hi,

I know that certain variables can be passed from Qualtrics to Pavlovia and then back to Qualtrics by inserting them in the URL, like participant ID. However, I want a variable generated within the PsychoJS task (e.g. RT, the average response time of a certain block of trials) to be passed to Qualtrics for later use. Is that feasible? If yes, then how?

Any comment is appreciated!

Thanks!

For this I’m using:

Begin Experiment

linked = 0
weblink='https://brookeshls.co1.qualtrics.com/jfe/form/surveycode'

Begin Final Routine

weblink+='&score='+str(totalScore)+'&participant='+expInfo['participant']+'&id='+expInfo['id']+'&session='+expInfo['session']+'&timeTaken='+timeTaken

Each Frame

if t>.5 and linked == 0:
    webbrowser.open(weblink,"_self")
    linked = 1

Text “Please click on Leave to continue.”

If you want the experiment to end as well, then don’t have ,"_self" in the link.

Thanks for the input. I don’t think I’ll need the weblink info in the Python portion, so I used your codes as a reference and rewrote them in JS. (The Py to JS convertion doesn’t really work well with me)

A couple of major difference I noticed -
weblink+='&score='+str(totalScore)
becomes
weblink+='?score='+totalScore.toString();

webbrowser.open(weblink)
becomes
window.open(weblink);

But anyway, it seems to have achieved what I wanted.
Thanks.

The first one was an error introduced when I changed the URL from a Qualtrics preview link (which already has a ? in it) to a live link.

The second works for me because I have webbrowser=window in code_JS as per my crib sheet (see pinned post)

Even when I’m not going to use an experiment offline I code the snippets in Python with as much auto translation as possible

1 Like