Open Forum

 View Only
  • 1.  A/B Testing in Surveys

    Posted 12-01-2023 18:08

    Good afternoon. Long-time user, first time commenter... :) 

    I have the need to perform some A/B testing for a question in a survey. For example, I have a question with say 15 options. 

    What I would like is the system to randomly present say 7 of the 15 options to the respondent. The next respondent would see a different set of 7, randomly presented options, some may be the same, but not all. Icing on the cake would be,  if there was a way to have three of the options be fixed, and the other presented randomly to the respondents. 

    I can handle the latter part by making the three fixed options as their own question that would be presented to everyone, but the other part is still stumping me. 

    Does anyone have any experience with this question or any thoughts as to deal with something like this? 

    Thanks in advance! 


    Kevin Bailey
    Senior Business Analyst and UI UX Designer
    International Monetary Fund

  • 2.  RE: A/B Testing in Surveys

    Posted 12-01-2023 18:31

    Good afternoon, Kevin! It's great to see you engaging with the community.

    Your idea of A/B testing in a survey is interesting and can certainly be achieved. Here's a high-level approach to handle this:

    1. Fixed Options: As you mentioned, you can handle the three fixed options by making them their own question that would be presented to everyone.

    2. Random Options: For the remaining options, you could use a random selection algorithm. Here's a simple example in Python:

    PythonAI-generated code. Review and use carefully. More info on FAQ.
    import random
    # List of your 12 options
    options = ['Option 1', 'Option 2', 'Option 3', 'Option 4', 'Option 5', 'Option 6', 'Option 7', 'Option 8', 'Option 9', 'Option 10', 'Option 11', 'Option 12']
    # Randomly select 4 options
    selected_options = random.sample(options, 4)

    This script will randomly select 4 options from your list each time it's run. You can adjust the number of options selected by changing the second parameter in the random. Sample () function.

    Please note that this is a very basic example and you might need to adjust it to fit into your survey system. If your survey tool supports scripting or has an API, you could potentially integrate such a feature directly.

    All I did was look up this information to come up with the best answer.  I'm not really versed. 

    Cody Nunn
    Sales Manager/Front Office Manager
    Holiday Inn Express & Suites Phoenix – TempeUnited States