$surveyCompleted?

On several days, I end my Micro Dialog with a survey. However, there would be a possibility that the participant has not read the Micro Dialog and/or not completed this survey. As I want a new Micro Dialog to start on the next day, I set in the first message “This message deactivates all former open questions.” This also means that the survey of the previous day is deactivated.

Would it be possible to create a variable $surveyCompleted, that reads whether the survey has been completed by the participant to:

  1. Get data on the participants that have and have not completed the survey?
  2. To send participants that have not completed it, the same survey next day (e.g. by creating a message/micro dialog that will only be activated when “$surveyCompleted text value equals No)”?

And how could I do so? :slight_smile:

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.