Setting up the display logic for survey questions


You can add display logic to your survey questions so that they are only shown to respondents if certain conditions are met.

To do this, click on the Edit display logic of this question.

You can then add conditions based on:

  • Respondent information that is recorded by Conjoint.ly such as device type and country.
  • How respondents answered any additional questions.
  • Any GET variables recorded for each respondent.
  • Any externally supplied variable uploaded to the report.

Click on Return to question set-up to return to option settings.

Add conditional logic to question

Displaying Gabor-Granger price levels conditionally

In Gabor-Granger experiments, you can choose to display the price levels conditionally to respondents.

Some common applications include:

  • Conditional pricing with a promotion attribute.
  • Conditional pricing based on a price attribute and a pricing structure attribute.
  • Regional information, e.g. a store brand that has unique names for different regions.

Follow these steps to set up the display logic for Gabor-Granger experiments:

  1. Click the button of the price level to access its advanced display settings.
  2. Click Add display logic to this item and specify the condition that you want to use.
  3. Specify the rules of condition for the price level.

In the example below, the survey aims to conduct a Gabor-Granger experiment in several target countries. Suppose you want to display only a certain price level to respondents from a certain country, you can do this by applying additional display logic and only show the price to respondents who are from that country (asked as an Additional Question earlier).

Example of applying conditional display logic to Gabor-Granger

Using Javascript to set up display logic

In some instances, question display logic may be more complex than the basic logic builder can handle. For example:

  • Computation on previous answers (such as computing BMI from height and weight).
  • Display probabilities (e.g. 30% of respondents should see the question).
  • Time spent in the survey so far.

It is possible to achieve that using JavaScript:

how to use javascript

The basic format of this function is:

function test() {
    return [CONDITION TO BE TESTED];
}

The test() function should contain all the calculations and return a boolean value, which will determine whether the question is shown (if true is returned, the question is displayed). Please note that the function may be executed multiple times (for example, early in the survey, when the survey script tries to pre-check if a question is likely to be displayed), so it should be designed not to affect variables outside the function itself.

Display logic JavaScript example

Example 1: Show the question to approximately half of respondents

function test() {
   return Math.random() < 0.5;
}

Example 2: Show on mobile only

function test() {
   return ($(window).width() <= 480);
}

Example 3: Show on desktop only

function test() {
   return ($(window).width() > 480);
}

Using answers to other questions

To refer to previous answers in the survey, you must first identify the question field id via your browser’s developer tools, these might be something like id='additionalQuestions1-short-answer', in which case you could access the value with: $("#additionalQuestions1-short-answer").val(). This value could then be processed with JavaScript and JQuery functions.

Applying conditional display logic to conjoint levels

In your conjoint experiments, you can display attribute levels conditionally based on other information, such as answers to previous questions in the survey, GET variables, or other levels in the same conjoint alternative.

Applying conditional display logic to blocks

Beside individual survey questions, you may also apply display logic to the question blocks. This also allows you to individually select which stimuli/SKUs to display to the respondents based on your condition.