How to transfer numeric answer + random number from anonymized survey 1 to survey 2 for raffle? | XM Community
Skip to main content
Hi Everyone, I would like to transfer a numeric answer from one of the questions in survey 1, which should be completely anonymized, to survey 2 where respondents can add their email address to participate in a raffle. The price to win is partly based on one numeric answer in survey 1. To ensure that these survey cannot be linked, I would like to add a random number to the numeric answer in survey 1 to be send to survey 2. I would be super grateful for any advice on how to implement this. Thank you!

To prevent potential linking, I think you would need to add a random number to the numeric answer in a way that it is not saved to survey 1's dataset. You could do this by using JS in a Custom End of Survey message that adds a random number to the numeric answer and then constructs a query string to bring the adjusted number to survey 2 when the respondent is redirected.

To give it a try, first create the Embedded Data field "number" and put it at the top of survey 2's Survey Flow. Also get the anonymous link for survey 2.

Then, create a Custom End of Survey message for survey 1 and use the HTML/Source view "<>" to add the below, updating everything to the left of the "?" for the "link" var with the anonymous link for survey 2. Also, if you are using a Text Entry question for the numeric answer in survey 1, update the QID in the JS with whatever the question is in survey 1. You can also adjust the random number to be a greater range than the current 1 to 20.

<script>
var answer = "${q://QID14/ChoiceTextEntryValue}";
var numanswer = parseInt(answer);

function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1) + min); // The maximum is inclusive and the minimum is inclusive
}

var rand = getRandomIntInclusive(1, 20);

var number = numanswer + rand;

var link = "https://brand.az1.qualtrics.com/jfe/form/SV_123456789?number="+number;

window.location.href = link;
</script>&nbsp;

 


Leave a Reply