I looked for an answer to this and ended up making one myself.
1: add an embedded field with the name __js_[name] - for example, __js_Hotspot
2: on the hotspot question, update the addOnReady to the following
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
question = this.getQuestionInfo();
console.log(JSON.stringify(question));
});
Go to a preview of your survey, hit F12 in Chrome to open up the devtools and click on the console tab and user messages along the left. Go through the survey until you get to your hotspot question.
You’ll see some JSON describing the question, you want to note the values for Choices. Mine starts at 4 and then ends at 9. Write down these values or go back to editing your survey in another window.
3: back on the hotspot question, update the addOnUnload function to the below. replace 4 and 9 where your values start and end and replace Hotspot with the name you used for your embedded variable, without the __js_ at the beginning.
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
for (var i = 4; i <= 9; i++) {
if (this.getSelectedAnswerValue(i) == 2) {
Qualtrics.SurveyEngine.setJSEmbeddedData("Hotspot",question.Choices[i].Text);
break;
}
}
});
4: once this is saved, you should now have an embedded field that will have the text value of the selected hotspot, rather than the number value. you can use this field in flows so that you send the proper text value(s) of the regions selected rather than the number.
A couple notes:
- this is for only 1 selected region, if you want to record multiple regions update the loop so that whenever it finds a 2 in the value (2 = on and 1 = off) then it adds the text to a variable. remove the break and then at the end of the loop set the embedded data to the variable
- you probably want to delete or comment out the console.log
How to get the labels in your data for selected hotspots
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community.
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community.
Login to the Community
No account yet? Create an account
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community.
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
