> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create conditional logic in your surveys

> Show or hide survey elements and screens based on visitor responses by setting up conditional logic events in the Widget Studio.

You can trigger specific actions based on the values provided by your visitors when they interact with your survey. Conditional logic allows you to show or hide survey elements or screens depending on each user’s input.

## Show or hide an element based on a visitor's survey response

You can configure elements or screens to appear (or disappear) based on what users select or type in your survey elements. For example, if a visitor selects a specific answer in a multiple choice question, a Long Answer field may appear to ask for more details.

To do this, you create:

* **Element 1**, visible by default.
* **Element 2**, hidden by default.
* A conditional rule in the **Events** section to display Element 2 if a specific value is selected in Element 1.

### Example use case

Suppose you've built a multi-step NPS survey and want to customize the experience based on the user's score. For example, if a user give a score from 0 to 6 (a Detractor), you might want to display a follow-up question asking for more feedback. If the score is 7 to 10 (a Passive or Promoter), you can skip straight to a thank-you message.

In the following example, the survey consists of two screens:

* **Screen 1:** The NPS score question (0-10).
* **Screen 1 (Detractors only):** An open text field asking for the main reason behind the score.
* **Screen 2:** A confirmation screen ("Thank you for your feedback!).

#### Step 1: Set up your survey screens

In the Widget Studio, create both screens:

* Screen 1 with the NPS element
* Screen 2 with a confirmation message

<Frame>
  ![Screen 1](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/assets/widgets/create-a-widget-with-the-widget-studio/create-csat-nps-and-surveys/create-conditional-logic-in-your-surveys/screenshot-2025-06-10-at-3.45.08PM-1536x960.png)
</Frame>

<Frame>
  ![Screen 2](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/assets/widgets/create-a-widget-with-the-widget-studio/create-csat-nps-and-surveys/create-conditional-logic-in-your-surveys/screenshot-2025-06-10-at-3.44.05PM-1536x960.png)
</Frame>

Ensure Screen 1 is the default screen.

#### Step 2: Ask a follow-up question to Detractors

1. Select the NPS element.
2. In the **Settings** tab, under **Follow-up question**, select **Detractors**

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/assets/widgets/create-a-widget-with-the-widget-studio/create-csat-nps-and-surveys/create-conditional-logic-in-your-surveys/screenshot-2025-06-10-at-3.46.55PM-1536x960.png)
</Frame>

#### Step 3: Add a conditional logic event for Passives and Promoters

1. Go to the **Events** panel and click **Add event**.
2. Select **Survey/Form** as the trigger.

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/assets/widgets/create-a-widget-with-the-widget-studio/create-csat-nps-and-surveys/create-conditional-logic-in-your-surveys/trigger.png)
</Frame>

3. Choose **By element survey/form value**.

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/assets/widgets/create-a-widget-with-the-widget-studio/create-csat-nps-and-surveys/create-conditional-logic-in-your-surveys/survey-event.png)
</Frame>

4. Click **Select an element** > **NPS**.
5. Under **Selected value**, choose **Passives** and **Promoters**.

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/assets/widgets/create-a-widget-with-the-widget-studio/create-csat-nps-and-surveys/create-conditional-logic-in-your-surveys/passives-promoters-selected-1-1536x956.png)
</Frame>

6. Then, define the action. Click **Add action** > **Show element**.

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/assets/widgets/create-a-widget-with-the-widget-studio/create-csat-nps-and-surveys/create-conditional-logic-in-your-surveys/show-element-1.png)
</Frame>

7. Select **Thank you screen**.

<Frame>
  ![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/assets/widgets/create-a-widget-with-the-widget-studio/create-csat-nps-and-surveys/create-conditional-logic-in-your-surveys/ty-screen-1-768x655.png)
</Frame>

8. Define a second action: **Hide element** > **Screen 1**.

This setup means that Screen 2 will appear if the visitor selects a score between 7 and 10, ensuring a smooth transition from feedback to the thank-you screen.

#### Step 4: Simulate your widget

Here's what the final logic looks like:

1. Screen 1 is always shown first.
2. If the score is between 0 and 6, the follow-up question is shown.
3. When the visitor clicks **Submit** on Screen 1, they reach Screen 2.
4. For scores of 7 and higher, the follow-up question is skipped and users go straight to Screen 2.

This logic helps you gather more detailed insights from detractors while keeping the experience frictionless for other users.
