I want to record a count of how many times a respondent changes their window while taking my survey. I have the following code, but it doesn’t read in the `DocumentHiddenCount` embedded field (set to 0 at the start of the survey) correctly. When I look at it in my browser, the `”${e://Field/DocumentHiddenCount}"` disappears.
Qualtrics.SurveyEngine.addOnReady(function()
{
document.addEventListener("visibilitychange", () => {
var dhc = parseInt("${e://Field/DocumentHiddenCount}")
console.log(dhc)
dhc += 0.5
Qualtrics.SurveyEngine.setEmbeddedData("DocumentHiddenCount", dhc)
console.log(dhc)
});
});