Community Groups are officially here!
We've released Groups, a new feature that enables us to connect community members of similar industries and interests in a shared, private space. You can check out all of the details here, including information about who can join, how to join, and what Groups are currently offered. Please leave your feedback through this Community Groups Feedback Survey.

How can I randomly assign participants to one out of two surveys

NatMel
NatMel Community Member Qubie ✭
edited November 2019 in Custom Code

I have two identical surveys, except for the background of the survey. I need to randomly assign participants to one of the two surveys.
An alternative solution would be to repeat the questions and use the randomizer, but I cannot find a way to add a picture as a block background (it needs to have 60 % transparency).
Does anybody have a solution ?

Answers

  • ClairJ
    ClairJ Philadelphia, PACommunity Member, XM Advocate Superuser ✭✭✭✭

    Hi @NatMel I'm assuming you're using a generic survey link; otherwise, you could just do the random assignment ahead of time. Anyway, two things to consider...

    I'm not great with custom coding, but this thread may be a useful starting point.

    Another option may be to set embedded data at the beginning of your survey using the random number generator (see the very bottom of this help page). Then you could apply the randomizer based on whether that random number is above or below the mid-point of your range.

  • Akdashboard
    Akdashboard South CarolinaCommunity Member Superuser ✭✭✭✭

    Or just use the randomizer block in the survey flow display 1 of 2 surveys nested under it (in the form of survey blocks).

  • NatMel
    NatMel Community Member Qubie ✭

    Thanks for your help. @ClairJ, yes, I'm using a generic link.
    To answer both advices, I can't have embedded surveys, because it seems that the "background" of the survey is general, I mean I can't have specific/separate backgrounds for blocks (for which I can choose the opacity).
    I thought of creating a survey redirecting randomly toward survey1 and survey 2.
    thanks,

  • ClairJ
    ClairJ Philadelphia, PACommunity Member, XM Advocate Superuser ✭✭✭✭

    Ah right. Understood. How about this solution? It's a bit clunky, but I think it would work...

    1. Create a survey landing page in its own block, and set the random number embedded data as I described above. Require respondents to "enter" the survey.
    2. At that point, apply your randomizer based on the random number generator, but have it branch to two different "end of survey" elements.
    3. Program each "end of survey" element to redirect to the URL for one of your two surveys. You can do this by clicking "Customize" and then "Override survey options".
  • NatMel
    NatMel Community Member Qubie ✭

    That would be perfect, that what I tried a bit earlier but, it seems that I can't have two different "end of survey", just one link can be entered for one survey.
    In the meantime, I also tried to have background for blocks, wich worked using the following code
    jQuery("#SurveyEngineBody").css({"background":"url('enter_source')",
    "background-size": "cover",
    "background-repeat": "no-repeat",
    " background-position": "center center"});

    jQuery(".Skin #SkinContent").css({
    "background":"enter_source"
    

    thanks for your help

  • husikage
    husikage Community Member Qubie ✭

    Since I have 4 different surveys with their own randomizers, using another randomizer to randomly present surveys didn't work.

    I solved this problem by creating a separate project that shows an embedded link to the main surveys. You can use the randomizer inside the survey flow and set it to present only one of the blocks and evenly present them. You can add as many blocks (survey links) as you wish and the participants will be shown and able to click on only one of them.

    To avoid clicking to the next button without clicking on the text, set question type to Text/Graphic, use the rich content editor to add embedded links, and hide buttons by adding the code below to javascript of the questions.


    Qualtrics.SurveyEngine.addOnReady(function () {

      $('NextButton').hide();

      $('PreviousButton').hide();

    });

  • ahmedA
    ahmedA IndiaCommunity Member, XMPN Member Wizard ✭✭✭✭✭

    Is it possible for you to share a screenshot of your setup?

    I'm just curious why this didn't work:

    Since I have 4 different surveys with their own randomizers, using another randomizer to randomly present surveys didn't work.

  • husikage
    husikage Community Member Qubie ✭

    I changed it so I don't have a screenshot of the previous setup.

    Basicly, if each of the sub-surveys has complex flows themselves (including many questions and randomizers), arranging an umbrella randomizer for 4 surveys is nearly impossible. Creating a separate survey in which there are just 4 questions randomly presented including embedded links is much easier to keep track.

  • ahmedA
    ahmedA IndiaCommunity Member, XMPN Member Wizard ✭✭✭✭✭
    edited May 30

    So you weren't loading the sub-surveys from the library, but hardcoding them into one big survey?