# Scene branching

{{< glossary_definition "branching" >}} {{< badge_sdk_min ios="19.6+" android="19.9+" >}}

See also the [Scene Branching](https://www.airship.com/docs/guides/features/messaging/scenes/branching/) feature guide.

### Example branching implementation 

This example illustrates setting up branching for follow-up questions about answers to an NPS survey asking users to rate their recent experience.

With a linear Scene, you can add questions after an NPS survey, but all users would see the same questions and in the same order. If a user indicates they had a negative experience and you ask them about positive interactions, that can be frustrating to the user and add to their negative impression.

Using branching, design a path to different follow-up questions according to the user's answer: 
  * If they submit a negative or low score, branch them to questions focused on understanding their pain points.
  * If they submit a positive or high score, branch them to questions about what they enjoyed or how you can further enhance their experience.

![Branching in a customer satisfaction survey](https://www.airship.com/docs/images/branching-use-case_hu_334ca38d89df7aec.webp)

*Branching in a customer satisfaction survey*

### The branching map

You can set up branching while [configuring Scene content](https://www.airship.com/docs/guides/messaging/in-app-experiences/configuration/content/). Select the branching icon in the left sidebar. This view is a map of the Scene that shows the path a user takes between screens. Each screen in the Scene is represented as a card:

![The branching view of a Scene](https://www.airship.com/docs/images/branching-map_hu_c27b6c556e45adf.webp)

*The branching view of a Scene*

![Card labels for screens in the branching view](https://www.airship.com/docs/images/branching-logic-icons_hu_4f42a0f11ce15d9a.webp)

*Card labels for screens in the branching view*

Each card in the map displays the screen name and icons for the components that can be used for setting branching logic:

* Selected NPS survey score
* Answer to single or multiple choice question
* When a button or image configured with an action is clicked/tapped

Screens that contain a button or image configured with the Submit Responses action also have a Submit label.

For more about these, see [NPS](https://www.airship.com/docs/guides/messaging/in-app-experiences/configuration/content/#nps) and [Question](https://www.airship.com/docs/guides/messaging/in-app-experiences/configuration/content/#question) in *Configuring Scene content* and [Actions](https://www.airship.com/docs/guides/messaging/in-app-experiences/configuration/button-actions/).

In addition to setting logic rules to create paths, you can and also add, duplicate, and remove screens from the map.

## Configure branching

In the [Content](https://www.airship.com/docs/guides/messaging/in-app-experiences/scenes/create/#content) step of a Scene, select the branching icon in the left sidebar. From there, you can set branching logic to create paths between screens. You can also add, remove, and duplicate screens and open them for editing.

![Management options when configuring branching for a Scene](https://www.airship.com/docs/images/branching-manage_hu_245238bbbded1cba.webp)

*Management options when configuring branching for a Scene*

Branching and screen management options:

| Option | Description | Steps |
| --- | --- | --- |
| **Set the branching logic for a screen** | The Logic panel will open for editing. | Select a screen card, and then follow the steps in [Set branching logic](#set-branching-logic). |
| **View a summary of the branching logic for a path** | A modal window will display a summary of the _if/then/else_ statement for that path. | Select the connecting line between two screens. Select another location in the map to close the modal. |
| **Remove a path between screens** | Any rules directing to the branched screen will be deleted from the branching logic determining the path. When all rules are deleted, **All other cases** will change to **Always**, and the **Go to** screen setting will remain the same. | Select the connecting line between two screens, and then select **Delete branch**. |
| **Add a new screen as a branch** | The new screen will be added as branch from the selected screen. The branching logic rule will be set to go to the new screen without a condition. | Select the plus icon () to the right of a screen card. |
| **Duplicate a screen as a branch** | The duplicate screen will be added as branch from the selected screen. The branching logic rule will be set to go to the new screen without a condition. | Select a screen card, and then select the duplicate icon from the menu that appears above the card. |
| **Remove a screen** | The screen will be removed from the Scene. | Select a screen card, and then select the trash can icon (
) from the menu that appears above the card. You must also confirm deletion if the screen is branched from another screen. |
| **Edit a screen** | The selected or last edited screen will appear for editing its content elements and design properties. | For a specific screen, select a screen card, and then select the compose icon (
) from the menu that appears above the card. Otherwise, select the file icon in the sidebar. To edit, follow the steps in [Configure screens](https://www.airship.com/docs/guides/messaging/in-app-experiences/configuration/content/#configure-screens) in _Configuring Scene content_. |

As you design, the map updates to display changes and the paths between screens:

![Viewing branching logic between screens in a Scene](https://www.airship.com/docs/images/branching-logic-map_hu_fd80a4251134f1df.webp)

*Viewing branching logic between screens in a Scene*

### Set branching logic

![Configuring branching logic between screens in a Scene](https://www.airship.com/docs/images/branching-logic-configure_hu_65343ef01bc5936f.webp)

*Configuring branching logic between screens in a Scene*

From the branching map, select a screen's card, and then you can configure your *if/then/else* statement in the **Logic** panel.
   * By default, screens do not have *if* conditions and are set to go to the next screen according to the current screen order, and *else* is set to go to "None".
   * If your Scene has only one screen, you must add another before you can set branching logic. See the options for adding screens in [Configure branching](#configure-branching).

Configuration steps:

1. Select **Add rule** if you are not editing an existing rule.

1. For **If**, select and configure which action the user must perform on the screen. You can select from the available actions on the current screen or different screen. 

    To allow multiple or alternative actions for the rule, select **Add condition** and select and configure another action. Then, toggle the **AND/OR** selector to determine how to handle them:
      * ALL = the user must perform all the configured actions (boolean AND)
      * ANY = the user must perform any configured action (boolean OR)

   Configuration steps for actions:

   | Action | Steps |
   | --- | --- |
   | **Button action** | None. **Is tapped** is set by default. |
   | **Image action** | None. **Is tapped** is set by default. |
   | **Single choice question** | Select **is** or **is not**, and then select an answer. |
   | **Multiple choice question** | Select **answer includes** or **answer does not include**, and then select one or more answers. |
   | **NPS survey** | Select **is equal to**, **is not equal to**, **is lower than**, **is greater than**, **is lower or equal to**, **is greater or equal to**, and then select a value. |
1. For **Go to**, select which screen should appear if the user performs the actions as configured in step 2.

1. Under **In all other cases**, for **Go to**, select which screen should appear if the user performs any other action than those specified in step 2.

   Before rules have been set, **All other cases** is labeled **Always**, and **Go to** is initially set according to the current screen order. Changing the screen order using this setting does not affect the order in which they appear when [configuring screens](https://www.airship.com/docs/guides/messaging/in-app-experiences/configuration/content/#configure-screens). The section does not appear until you first select **Add rule**.

To close the Logic panel, select the X in its top right corner.

### Testing branching logic

You can test your branching logic the Interactive mode [Preview tool](https://www.airship.com/docs/guides/messaging/in-app-experiences/configuration/content/#preview-tools). Select the file or gear () icon in the sidebar to access the Preview tools. To test on actual devices, send the Scene to a [Test Group](https://www.airship.com/docs/reference/glossary/#preview_test_groups). See [Audience](https://www.airship.com/docs/guides/messaging/in-app-experiences/scenes/create/#audience) in *Create a Scene*.

## Reports

Message reports for Scenes includes a flow chart that displays a visual representation of the user progression between screens and metrics associated with each screen and branch. See [Performance](https://www.airship.com/docs/guides/messaging/in-app-experiences/scenes/create/scene-reports/#performance) in *Scene Reports*.

![Branching represented in a Scene message report](https://www.airship.com/docs/images/scene-user-paths_hu_2860ded64d0ae9bd.webp)

*Branching represented in a Scene message report*