For simplicity, lets assume that we have a single survey and we need to know the next day whether the participant has done the survey or not,
Case A: When there is no follow up dialog to the survey, (Eg. “Thank you for filling the survey”)
We can create a variable as you said “$surveyCompleted” and set it as say, “False” before the survey is sent in the corresponding micro-dialog. This variable when created in the variable tab, the access setting should be set as “manageable by service”. We can then set this variable “True” at the end of the corresponding survey in Limesurvey. One way is that the following code needs to be added in the end message section of the survey. (Please press button in the “End message:” as shown in the picture below the code. The “End message:” can be found by going to a survey and Settings->Text elements)
<script>
function checkReady() {
if (window.postMessage != undefined && window.postMessage != null && typeof window.postMessage === 'function' && window.postMessage.length === 1) {
sendResults()
} else {
setTimeout(checkReady, 100)
}
}
function sendResults() {
var send_data = {
'variable':'$surveyCompleted',
'value': 'True'
};
window.postMessage(JSON.stringify(send_data));
window.postMessage('complete');
}
$(document).ready(function() {
setTimeout(checkReady, 100)
})
</script>
After adding the code the screen looks similar to below,
Please note that you need to be an administrator in Limesurvey to add codes as above.
Case B: When there is a follow up dialog to the survey, (Eg. “Thank you for filling the survey”)
Steps in Case A also works here. But, we can do it simpler in Case B. We can create a variable as you said “$surveyCompleted” and set it as say, “False” before the survey is sent in the corresponding micro-dialog. Then in the follow up dialog that is called using “user-intent”, we can set the variable $surveyCompleted" to be true.
Using this variable $surveyCompleted, we can check if the survey is completed the previous day and according send the messages. For continuous checking everyday, for sending missing surveys based on the intervention, additional variables can be created and the intervention needs to be designed accordingly.