# Abandoned Cart Reminder for Mobile Users

If your platform sells products or services, you might find that end users sometimes add items to their shopping cart but do not complete the purchase.

This tutorial describes how to track end users who abandon items in their shopping cart and send them reminders to complete the purchase.
  
## Use cases [#use-cases]

Use this tutorial for all applications that have a catalog of items.

Example:

- e-commerce applications
- Classifieds
- Food delivery

## Products and channels

- [People](https://www.infobip.com/docs/people)
- [Moments](https://www.infobip.com/docs/moments)
- [Mobile push and In-app messages](https://www.infobip.com/docs/mobile-push)
  
## Prerequisites

- Infobip account. If you do not have an account, [sign up](https://www.infobip.com/signup) for an account.
- Set up Mobile SDK in your app. For instructions, refer to [Mobile application profile](https://www.infobip.com/docs/mobile-push/get-started/mobile-application-profile#set-up-mobile-sdk).
  
## Process overview

1. In People, identify the IDs of the template events that you want to use.  
2. Integrate the events in your app so that the app can send the events to the Infobip platform.
3. In Moments, do the following.
   1. Create a flow that is triggered by the event.
   2. Map the list property of the event to a flow variable.
   3. Use the flow variable in a Mobile push notification to personalize the message to the end user and remind them to complete the purchase.

The tutorial uses the following.

- *Added to cart* and *Complete Purchase* template events in People. Alternatively, you can create and use custom events.
- A flow in Moments to send Mobile push notifications to end users. The flow described in this tutorial is also available as a template, *Abandoned cart reminder for mobile users*, in Moments. You can either set up this template for your application or create a flow from scratch.  

## Implementation steps

### Identify the template events in People

Identify the IDs of the Added to cart and Item Purchased template events.

For each event, follow these steps.

1. On the Infobip [web interface](https://portal.infobip.com//), go to **People** > **Events** > **Template Events** tab.
2. Search for the event.
3. Select the event.
4. Note the Event ID.

### Set up your mobile app to send events

On your mobile app, when an end user adds an item to the cart or completes a purchase, you can send these events to the Infobip web interface.

Use the event IDs of the *Added to cart* and *Complete Purchase* events to set up tracking for the events. To integrate template events, refer to the [Custom Events](https://www.infobip.com/docs/people/events#events-custom-events) documentation because template events function similar to custom events.

Important
If you also have a website and use the same events for adding to cart and completing purchases, push notifications are sent when the user completes these actions on the website. This functionality is helpful if your shopping platform supports a combined web/mobile experience. Example: When an end user marks an item as favorite on a website, the item is displayed as a favorite in the mobile app. If you do not want this integration, use different custom events for web and mobile platforms.

### Create the flow in Moments

1. On the Infobip [web interface](https://portal.infobip.com//), go to **Moments** > **Communications** tab.
2. Select **Create Flow** > **Start from Scratch**.
3. Select **Trigger** > **People real-time event**.
4. In the **Conditions** section, select the *Added to cart* template event.
5. In the **Added to cart happened** branch, add the **Wait for an event** element.
6. In the **Wait for an event** element > **Conditions** section, select *Item Purchased* template event.
7. Set a waiting time of 1 day or less.
8. In the **If none matched** branch, add the **Send push or in-app notification** element.
9. In the **Send push or in-app notification** element, select your application.
10. In the **What kind of message do you want to send?** field, select **Push notification**.
11. In the notification, define the message content. Example Remind the end user that items that they selected are still in their cart and that they can complete their purchase.
12. To lead the end user to a specific page in your app such as the shopping cart in the On-tap action section do the following.  
   1. In the **Action** field, select **Page in Mobile App**.
   2. In the **Deep link** field, define the deep link.
13. Select **Finish editing**.
Note
For more information about using deep links refer to the following iOS: [https://github.com/infobip/mobile-messaging-sdk-ios/wiki/How-to-use-%22deeplink%22-to-land-user-to-a-particular-app-page%3F](https://github.com/infobip/mobile-messaging-sdk-ios/wiki/How-to-use-%22deeplink%22-to-land-user-to-a-particular-app-page%3F) Android: [https://github.com/infobip/mobile-messaging-sdk-android/wiki/How-to-use-%22deeplink%22-to-land-user-to-a-particular-app-page%3F](https://github.com/infobip/mobile-messaging-sdk-android/wiki/How-to-use-%22deeplink%22-to-land-user-to-a-particular-app-page%3F)
14. If the end user still has not completed the purchase you can send a second reminder. Add another **Wait for an event** element with the same conditions and another **Send push or in-app notification** element. In the message include a promo code to encourage the end user to complete the purchase.
15. Select **Validate**.
16. Select **Launch now**.

Your completed flow should be similar to the flow in the following image.