Integrating Hosted Content with Survey Platforms

Qualtrics

If you’d like to integrate experiments hosted on the above sites into Qualtrics you can do so in a few ways I got from this post. Perhaps the easiest option is using an HTML iFrame. To do this, all you need is to create a question block in Qualtrics with a ‘text/graphic’ question in it. Then, click the ‘HTML view’ tab in the top right and add the following code: <iframe height=500 width=600 src=“URL LINK TO YOUR TASK”> (make sure to change the height and width to the same as your JavaScript code too). It’s fairly easy but can look a little janky and need some reconfiguring. Another option is to have the experiment open in a new tab with this code: <a href=“URL LINK TO YOUR TASK” target="_blank">Click Here</a> (i.e. the standard HTML link syntax this sentence uses), although I’ve only been able to get this to work with Gorilla - I’ve asked around for help with that and will get back with an update when I can.

Finally, you can set up two Qualtrics surveys and use a link to redirect participants from the first one to your hosted survey, and then from that hosted survey back to the second survey. Place the redirect link at the end of the first Qualtrics survey as suggested here or with the following JavaScript: Qualtrics.SurveyEngine.addOnReady(function() {setTimeout(function () {window.location.href = “URL LINK TO YOUR TASK“;},5000)}); (see here on how to add JavaScript to Qualtrics - I also deal with this below).

One important component of this redirect method is making sure you’ve kept track of who your participants are. We’ll do this by embedding their random participant ID number into the URL and keeping this both times we do a redirect. Firstly, set a random participant ID. Then embed this into the URL we send from the the first Qualtrics survey, e.g. https://github.com/jspsych/jsPsych/discussions/754.

Then, you’ll need to use jsPsych to grab that data from the URL so we can pass it back to Qualtrics. The website you’ve used to host your experiment then needs to link back to the second qualtrics survey (which really just functions as part 2 of the first one), but make sure you’ve appended the participant ID to the URL in a way Qualtrics will understand. As for how to redirect from your survey hosting site back to Qualtrics: in cognition.run, check out the source code for their ‘copy of redirect participant after finish’ example task, where they just put the following line: window.location.href = "URL LINK TO YOUR TASK” at the end of their on_finish() function. Gorilla’s redirect node can be used to do the same, and also see this page on Qualtrics integration. As the Pavlovia integration with jsPsych was a little involved, I haven’t been able to set that up just yet, although apparently the information here should be of use.