Creating a "Last Seen" Question
Update:
As of 5.5.3, this article is no longer relevant. The latest preferred method is to use the new routing start question "{All Questions}".
After/During > {All Questions} > Set Value to "HID_LastSeen" variable > CurrentQuestion.Shortcut
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.
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.
This method utilizes a hidden variable in your survey, coupled with JavaScript in the "before content" and "footer" fields of Design's Internet Settings.
How
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:
<script type="text/javascript">
$(document).ready(function() {
if ("??LastSeen??" != "!!CurrentQuestion.Shortcut!!")
{document.getElementsByName("askiaStay")[0].click();}
});
</script>
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.
Side-Note #1
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.
Side-Note #2
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.