How to save randomly generated JavaScript options? | XM Community
Skip to main content

I have a survey question that generates a random string using JavaScript code, which updates an HTML element to display the string and allow responders to rate qualities of the string. I was wondering if there was an efficient way to somehow save the random string that gets generated so that it is displayed in the data report and I can see what string the responder was rating.

Define an embedded data field in the survey flow, then save the random string to the embedded data field in your JS.


https://community.qualtrics.com/XMcommunity/discussion/24045/how-to-save-randomly-generated-javascript-optionsAs for setting embedded data, you can use:
Qualtrics.SurveyEngine.setEmbeddedData( 'embeddedDataVariable', value );
Just make sure that that embedded data element exists in your survey flow before you set it.
Hope it helps!


Leave a Reply