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

Tracking participants who leave the survey window

  • November 27, 2020
  • 1 reply
  • 70 views

Forum|alt.badge.img

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?

1 reply

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • December 1, 2020

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.