Hi all,
I’m running into some issues with embedding participant data from behavioral tasks that were coded in JavaScript (JS). Previously, we were on a different survey platform (SurveyGizmo) that allowed for a lot more custom scripting. I’m hoping to have the behavioral task data embedded into the participant’s Qualtrics survey data, but it’s not quite working.
The tasks are coded in JS and hosted on an external site; the tasks are embedded into Qualtrics using JS (see code below).
Any guidance would be greatly appreciated!
_Here’s the embedded code below, if you’re curious:_
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
jQuery("#Header").html('<iframe allowfullscreen=“”SOURCE OF TASK HERE“ style="width:100%;height:100vh;"> ></iframe>');
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
// Listen for the study sending data
window. addEventListener('message', (event) => {
console.log('sending data...');
var data = event.data;
// Make sure that data is included
if (data) {
Qualtrics.SurveyEngine.setEmbeddedData(“TASK”,data);
var d = Qualtrics.SurveyEngine.getEmbeddedData("TASK");
console.log(d);
}
})
});
Be the first to reply!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.