- Posts: 1
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
// Listen for the study sending data window.addEventListener('message', function(event) { // Make sure that the event is from lab.js, then ... if (event.data.type === 'labjs.data') { // ... extract the data lab.js is sending. // We're going to work with JSON data const data = event.data.json // ... save data and submit page Qualtrics.SurveyEngine.setEmbeddedData('labjs-data', data) document.querySelector('.NextButton').click() } })
sdyckfr wrote: I have an experimental video segmentation task set up with lab.js ( lab.js.org ) and want to integrate it in LS (3.20.2+191119) similar to how the lab.js developers describe its integration with Qualtrics ( labjs.readthedocs.io/en/latest/learn/deploy/3a-qualtrics.html ).
Could anyone help me out with how to set up the JavaScript in LS to data from the lab.js experiment in a hidden textarea within LS?
The description for Qualtrics uses an "embedded data field" in Qualtrics, which - to my understanding - Limesurvey does not have. The lab.js experiment is embeded in an iframe. The following code is used for connecting lab.js and the qualtrics "embedded data field".
Code:// Listen for the study sending data window.addEventListener('message', function(event) { // Make sure that the event is from lab.js, then ... if (event.data.type === 'labjs.data') { // ... extract the data lab.js is sending. // We're going to work with JSON data const data = event.data.json // ... save data and submit page Qualtrics.SurveyEngine.setEmbeddedData('labjs-data', data) document.querySelector('.NextButton').click() } })