postMessage from jsPsych in iframe to Qualtrics | XM Community
Question

postMessage from jsPsych in iframe to Qualtrics

  • 19 March 2019
  • 2 replies
  • 108 views

I'm trying to run a visual perception experiment in Qualtrics. The experiment itself is written using jsPsych, and hosted on separate server, but embedded within a Qualtrics questionnaire using an iframe. Ideally, I'd like to be able to send the data from the iframe into Qualtrics. I understand this should be possible using window.parent.postMessage() in the iframe, and a window.addEventListener('message', function(event){}) line in the javascript code for the relevant question in Qualtrics, and then have it store the message in Embedded Data.

Has anyone else done this successfully? Is it even possible to send a message from an iframe to Qualtrics?

2 replies

Hi bamfojm were you ever able to figure this out? I'm working on a similar project right now. Thanks.

Userlevel 7
Badge +21

Find whereever this https://www.jspsych.org/core_library/jspsych-core/#jspsychendexperiment is in the script file and send the message to the parent window.
See this post to get some help on getting the message from the experiment: https://www.qualtrics.com/community/discussion/14518/embedded-survey-is-there-a-way-to-detect-end-of-survey
If you can't figure it out, send me a private message, I'll see how I can help.

Leave a Reply