- Posts: 1
- Thank you received: 0
lab.js integration
1 year 1 month ago - 1 year 1 month ago #191504
by sdyckfr
lab.js integration was created by sdyckfr
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".
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".
// 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()
}
})
Last edit: 1 year 1 month ago by sdyckfr.
The topic has been locked.
1 year 1 month ago #192129
by Skyler9
Its important to understand that running a controlled experiment on an algorithm that is so complex is nearly if not completely impossible. Thousands of variables are at play and it’s our job to try and minimise those variables to the best of our abilities. By doing so, we have to restrict the questions we may be able to answer to their simplest form. Only by doing that we may get some meaningful answers.
Replied by Skyler9 on topic lab.js integration
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".
// 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() } })
Its important to understand that running a controlled experiment on an algorithm that is so complex is nearly if not completely impossible. Thousands of variables are at play and it’s our job to try and minimise those variables to the best of our abilities. By doing so, we have to restrict the questions we may be able to answer to their simplest form. Only by doing that we may get some meaningful answers.
The topic has been locked.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 13949
- Thank you received: 2470
1 year 1 month ago #192142
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.
Replied by DenisChenu on topic lab.js integration
1. Add a text question to store the data
2. Add javascript : labjs.readthedocs.io/en/latest/learn/deploy/3-third-party.html
3. Fill the input with data $("answer{SGQ}").val(theData) using jquery
See manual.limesurvey.org/Workarounds:_Manip...ime_using_Javascript
If you want a more automatic system : check manual.limesurvey.org/BeforeQuestionRender
2. Add javascript : labjs.readthedocs.io/en/latest/learn/deploy/3-third-party.html
3. Fill the input with data $("answer{SGQ}").val(theData) using jquery
See manual.limesurvey.org/Workarounds:_Manip...ime_using_Javascript
If you want a more automatic system : check manual.limesurvey.org/BeforeQuestionRender
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.
The topic has been locked.