I've integrated an external page that send messages back to Qualtrics where it is saved in embedded data. There seams to be several problems with the way that Qualtrics manage external pages in iframes. First, when the user press Next in Qualtrics is the external page in the iframe reoaded and therefore are init messages sent from the external page back to Qualtrics with the result of destroying the collected data. Second (and less serious), Qualtrics seams to load the external page in the iframe twice which result in that two init messages are sent from the external page back to Qualtrics (which in this case means that randomization is performed twice in the external page where this logic is placed).
The external page can be seen here (where it has been embedded in an iframe in a similar way as in Qualtrics).
Qualtrics JS used to save the result
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
window.addEventListener('message', function _data_handler(event) {
if (event.data.sender == 'press_zero') {
Qualtrics.SurveyEngine.setEmbeddedData('press_zero_data', event.data.msg)
console.log('Main window:', event.data.msg)
}
if (event.data.sender == 'press_zero_cond') {
Qualtrics.SurveyEngine.setEmbeddedData('rand_prosocial', event.data.msg)
console.log('Main window:', event.data.msg)
}
else
console.log('Some other message')
});
var iframe = document.getElementById("press_zero");
iframe.contentWindow.focus();
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
Additional information is available here (in a github issues used in the project):https://github.com/colmsjo/qualtrics/issues/4
Any help to work around these problems is much appreciated!!
Page 1 / 1
https://community.qualtrics.com/XMcommunity/discussion/18373/integration-of-external-pagecolmsjo For me same setup worked perfectly and data is being saved in Qualtrics.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.