Tracking participants who leave the survey window | XM Community
Skip to main content

Hi,
In my survey, I have a task that participants can answer easily by using the internet.
Because of that, I am looking for function that find out participants who leave the survey window.
I tried this, with embedded data variable called "RAT1":
Qualtrics.SurveyEngine.addOnReady(function()
{  
var RAT1 = Boolean(("${e://Field/RAT1}"))
document.addEventListener("visibilitychange", function() {
  console.log(document.hidden);
  RAT1 = document.hidden;
Qualtrics.SurveyEngine.setEmbeddedData('RAT1',RAT1);
})
});
unfortunately, it is not working for me.
maybe someone could help?

Your function gets activated everytime there is a visibility change. Hence, when a person comes back to your survey,

document.hidden 
will become
true 
again.
I suggest using a counter. Start with zero, if its value is more than one, then set the embedded variable.


Leave a Reply