Scroll

Creating a "Last Seen" Question

Follow
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.
Applies to askiadesign
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. 

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.

Have more questions? Submit a request

Comments

  • Avatar
    Sari Nieminen

    The script addition in the footer does not do the trick. LastSeen variable still only stores the last question responded. Even though you have given response to the first item at the following loop.

  • Avatar
    Chirag Bhavsar

    @Sari: Footer script is incomplete... it should read as... (see additional close brackets before the end of <script> tag,)

    <script type="text/javascript">
    $(document).ready(function() {
    if ("??LastSeen??" != "!!CurrentQuestion.Shortcut!!")
    {document.getElementsByName("askiaStay")[0].click();}
    });
    </script>

  • Avatar
    Michael Brennan

    @Chirag: Thanks for catching that; the article has been updated to reflect this change.