I have the requirement to randomly redirect to a new page out of 4 links at the end of surveys. Since end of survey block do not have option to add javascript code, I put the redirection code in the previous block as below -
Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
const chat_version = ["https://link1.com", "https://link1.com", "https://link1.com","https://link1.com","https://link1.com"];
setTimeout(function () {
window.location.href = chat_version[url_choice];},15000)
});
The above code sometimes work and sometimes doesn't redirect at the end of survey. I am unable to figure out the reason behind this. It's quite random and I cannot find the reason behind this.
Question
Redirect to a random selected link at the end of survey sometime works or sometime doesn't.

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