Store last answered questionnumber into an embedded data field of an unfinished response | XM Community
Solved

Store last answered questionnumber into an embedded data field of an unfinished response


Userlevel 3
Badge +5
In a survey I have set the option of partial completed responses set to recorded responses after 4 hours after the respondents start of survey. What I like to have is an embedded data field called 'LastQuestion' containing the last used question number. Like the column in the Data & Analysis tab under Responses in Progress where a column Last Question exists. Is such an option possible?
icon

Best answer by TomG 13 March 2020, 14:54

View original

10 replies

Userlevel 7
Badge +27
Add "LastQuestion" as an embedded data field in the survey flow and this JS to the header inside a `<script>` tag:
```
Qualtrics.SurveyEngine.addOnload(function() {
Qualtrics.SurveyEngine.setEmbeddedData("LastQuestion", jQuery(".QuestionOuter:last").attr("id"));
});
```
It will save the QID of the last question on the last page where they clicked Next.
Userlevel 3
Badge +5
Thanks! This works!
Badge +1

Hi guys,

I have the same problem as Nico_Leussink . Where is it possible to add JS to the survey flow? And can you detail what the "header" is please?
There is no solution to add the "Last Answer" as embedded data in the survey flow without JS?

Thanks by advance,
Victor

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/43555#Comment_43555You can't add JS to the survey flow. Add the JS to the header (Look & Feel - General - Header (edit) - <> (source mode)).

Badge +1

Thanks a lot for your help TomG 🙂
Do you also have the JS code regarding the progress? (By progress I mean the time someone spend on the survey).

Thanks by advance,
Victor

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/43563#Comment_43563The number of seconds someone has spent taking the survey is always stored in the embedded data field Q_TotalDuration.

Badge +1

Thanks for your help and reactivity.

I added the LastQuestion and Progress embedded data in the workflow of my surveys.
I know want to add it in the "respondent journey" in the repertory settings (see picture), but the data do not appear... Do you know why?
image.pngThanks again by advance,
Victor

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/43569#Comment_43569No, sorry.

Badge

Thank you! This is great!
Can it be done to give the user friendly question name instead of the QID?

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/53264#Comment_53264Not easily. The only way to get the question label to to turn on question numbers. Then you have to hide the question numbers and extract the last question number from the question html.
You should vote for this product idea.

Leave a Reply