|Summary||This article describes how to create a last seen question to show you what the last question the respondent saw/answered, using a "CurrentQuestion.Shortcut" parameter.|
|Written for||Scriptwriters and Survey Authors|
|Keywords||currentquestion; shortcut; last; seen; lastseen; design; askiadesign|
To download the attached example QEX (also located at the bottom of the article), click here.
When the survey is live and you notice an abundance of respondents dropping out of your survey, it may be beneficial to establish a way to determine exactly which part of the survey they are dropping out at in order to make changes or troubleshoot what else could be causing the issue.
Below is the script that you can insert into the "Contents -- Before Contents" field:
<input type ="hidden" id="_LastSeen" name ="_LastSeen" value="!!CurrentQuestion.Shortcut!!">
This line of script will input the Question's Shortcut name into our hidden "LastSeen" variable after the question has been answered and the next page has loaded. Note: the underscore is required when generating this, as it allows the script to write data to the question even when not on said screen.
Below is the script that you can insert into the "Header/Footer -- Footer" field:
if ("??LastSeen??" != "!!CurrentQuestion.Shortcut!!")
This line of script will continue to refresh the page (clicking on askiaStay) to check if our hidden "LastSeen" variable is different than the current question's shortcut. It will continue to do this until "LastSeen" has been written with the current question's shortcut value.
If you would like to only see the last question the respondent answered rather than the last question the responded saw, this can be achieved by simply not adding the above script into the Footer field.
If you are merging screens, this script will only populate the hidden "LastSeen" variable with the first question that shows up on the screen.
Example: Q1+Q2 are on a single merged screen. When this script is run, the hidden "LastSeen" variable will be populated with only Q1.
This also disregards any screen viewing/ordered preferences. If Q2 showed up before Q1 on the screen, the hidden "LastSeen" will still only be populated with Q1, not Q2.