Hello,
I am working on programming a conjoint survey experiment in Qualtrics using the following example: https://github.com/leeper/conjoint-example. However, I am unable to set the choices shown to survey respondents as embedded data using Javascript. I have tried a variety of approaches, and nothing seems to be working.
I have a Javascript array called a_list which contains the list of attributes for option A shown to survey respondents. I am sure that a_list contains the proper information because it is properly displayed with the question. I am trying to save a_list to embedded data as a single string variable, as in the above example, using Qualtrics.SurveyEngine.setEmbeddedData("traits1a", a_list.join("|"));. However, traits1a always shows up empty in my data.
(1) I have defined the embedded data at the beginning of the survey flow (prior to attempting to set it using Javascript).
(2) I have tried putting the code "Qualtrics.SurveyEngine.setEmbeddedData("traits1a", a_list.join("|"));" in an addOnPageSubmit() block, in the addOnload() block, in the addOnUnload() block, and in the addOnReady() block. Regardless of where I place the setEmbeddedData() code, the traits1a embedded data shows up blank in the data.
(3) I have tried using addEmbeddedData() instead of setEmbeddedData().
(4) I have tried defining a variable prior to setting the embedded data:
var traits_a = a_list.join("|");
Qualtrics.SurveyEngine.setEmbeddedData("traits1a", traits_a);
I'm not sure how to get this to work, and any help would be appreciated.
How do I set embedded data with Qualtrics using Javascript?

Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.