Hi Everyone:
I am putting together a survey where respondents will get a redeem code for a free drink upon submitting the survey. I want Qualtrics to get the one-time only code from a predefined list of codes in order to ensure the person did indeed complete the survey (so a person can't write in any code and get a free drink or use the same code over and over).
I came across the Rand function, but that does not use a pre-existing list, just a range of numbers that you set. Also, I am concerned it might generate the same number over time. Anyone know how to do this? Thanks in advance for your help!
Page 1 / 1
Can you control the drink codes? You could display the ResponseID embedded data field to users in the end of survey message (${e://Field/ResponseID) and have them redeem that for the drink.
https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/embedded-data/
Alternatively, you can set a quota for the number of codes you have available. When someone finishes the survey, they'll increment that quota. Then, in your end of survey message, you could enumerate and index the codes based on the quota count using Javascript (the quota field will change/be unique to your survey):
```
<script>
Qualtrics.SurveyEngine.addOnload(function()
{
var codes = ["code1","code2", "code3", "code4", "code5", "code6"];
document.querySelector("#EndOfSurvey").innerHTML = "Here's your code: " + codes["${qo://QO_UitB1v4imUFAuej/QuotaCount}"]
});</script>
```
https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/embedded-data/
Alternatively, you can set a quota for the number of codes you have available. When someone finishes the survey, they'll increment that quota. Then, in your end of survey message, you could enumerate and index the codes based on the quota count using Javascript (the quota field will change/be unique to your survey):
```
<script>
Qualtrics.SurveyEngine.addOnload(function()
{
var codes = ["code1","code2", "code3", "code4", "code5", "code6"];
document.querySelector("#EndOfSurvey").innerHTML = "Here's your code: " + codes["${qo://QO_UitB1v4imUFAuej/QuotaCount}"]
});</script>
```
If you put the codes in JavaScript, they can be stolen rather easily.
You should really do this with a web service. Put your codes in a database and have a script that requires a secret token dole them out one a time.
The problem with using response ids is that you don' t know what they are ahead of time. So, you have to put some process in place to activate a new code each time someone completed the survey.
You should really do this with a web service. Put your codes in a database and have a script that requires a secret token dole them out one a time.
The problem with using response ids is that you don' t know what they are ahead of time. So, you have to put some process in place to activate a new code each time someone completed the survey.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.