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

# Abandoned Session Flow

**Goal:** send a communication after a session ends for an abandoned cart, abandoned product view, or abandoned category view, in a defined priority order.

To solve this, we'll set up a flow.

## Before you create the flow

* Add automated campaigns in the channels you need: email, SMS, Viber, mobile push, or web push.
  * Configure product output using the following parameters:
    * For abandoned cart — `Session.GetAddedToListProducts()`
    * For abandoned category — `Session.ProductCategoryViews`
    * For abandoned product view — `Session.ProductViews`
  * Or use the new constructor to output products without parameters or code — refer to the abandoned cart, abandoned product, and abandoned category guides.

## Build the flow

<Steps>
  <Step title="Set the trigger event">
    Set the flow to start on the **Customer left site or application** event and limit triggering to once every 3 days.

    <Note>
      **About the event**

      A session is a continuous chain of actions on the site (tracked by the Maestra tracker) or in the app (tracked by the Maestra SDK). It automatically closes 30 minutes after the customer becomes inactive.
    </Note>

    **Event settings**

    **Actions performed during the session**

    Available actions:

    * Product added to a list
    * Product view
    * Product category view

    If one or several action types are selected, the flow will trigger only on customer sessions that contain those actions.

    If no actions are selected, the flow will consider all sessions.

    **Orders during the session**
    Lets you limit sessions by whether or not orders were placed in them.
  </Step>

  <Step title="Wait 30 minutes">
    Also restrict the exit from the wait block so the flow doesn't send messages at night.
  </Step>

  <Step title="Check customer eligibility">
    Verify that the customer:

    * Has not placed any orders in the past 24 hours
    * Has not received any campaigns in the past 24 hours
    * Has an active subscription
    * Has a valid contact in the campaign's channel
  </Step>

  <Step title="Filter for cart additions">
    Filter by session — a product was added to the cart and the product is still in the list.
  </Step>

  <Step title="Send the abandoned cart message">
    If the conditions above are met, send the abandoned cart campaign.

    <Tip>
      **What to include in the campaign**

      * Alongside the products from the cart, you can add recommendations:
        * Complementary products to the list — to help the customer complete the order;
        * Similar products to the list — alternatives that might be a better fit.
      * The parameter for recommendations to a list is `Recipient.Recommendations.{algorithm_name}`. Or use the new constructor.

      You can evaluate effectiveness and pick the best version using A/B testing.
    </Tip>
  </Step>

  <Step title="Handle sessions with no cart additions">
    If there was no product added to the cart, continue to the next check.
  </Step>

  <Step title="Filter for product views">
    Check whether the session contained a product view.
  </Step>

  <Step title="Send the abandoned product view message">
    Send the abandoned product view campaign.

    <Tip>
      **What to include in the campaign**

      * You can add recommendations — products similar to those viewed in the last session — alternatives that might be a better fit.
      * The parameter is `Recipient.Recommendations.{algorithm_name}` (or use the new constructor).
    </Tip>
  </Step>

  <Step title="Handle sessions with no product views">
    If there was no product view, continue to the next check.
  </Step>

  <Step title="Filter for category views">
    Check whether the session contained a category view.
  </Step>

  <Step title="Send the abandoned category view message">
    Send the abandoned category view campaign.

    <Tip>
      **What to include in the campaign**

      * You can add recommendations — popular products from the categories viewed in the last session.
      * The parameter is `Recipient.Recommendations.{algorithm_name}` (or use the new constructor).
    </Tip>
  </Step>

  <Step title="Launch the flow">
    The flow is ready. You can turn it on.
  </Step>
</Steps>

## Flow logic summary

| Step | Condition                                                                       | Action                                |
| ---- | ------------------------------------------------------------------------------- | ------------------------------------- |
| 1    | Customer left site or application (max once every 3 days)                       | Start the flow                        |
| 2    | Wait 30 minutes, skip nighttime sends                                           | Delay                                 |
| 3    | No orders or campaigns in the past 24 hours, active subscription, valid contact | Continue                              |
| 4    | Product added to cart and still in the list                                     | Send abandoned cart campaign          |
| 5    | No cart addition, but product was viewed                                        | Send abandoned product view campaign  |
| 6    | No product view, but category was viewed                                        | Send abandoned category view campaign |

<Note>
  Priority order matters: the abandoned cart message takes priority over abandoned product view, which takes priority over abandoned category view. Each customer receives only one message per session.
</Note>
