Tracking Abandoned Carts

In this document, we are going to show you how to track abandoned shopping carts as custom events, which can then be used to trigger automated notifications to recover them.

These steps are for non-Shopify websites. If you are using Shopify, then Abandoned Carts are automatically tracked for you as an event and you do not need to follow these steps below. Simply head to your dashboard and activate abandoned cart notifications under "Notifications" > "Triggered Notifications".

 

Note: While older "_aimtellAbandonedCart" functions will still function, these are being deprecated in favor of the below. At your earlier convenience, please update your site to ensure they are using these new versions.

 

Step 1: Abandoned Cart Listener Snippet

The first step is to add the following snippet on your "Cart" or "Checkout" page. Place this just below your closing "</body>" tag.

<script>
_at.track("cart", {"type" : "add-to-cart", "delay" : 30 });
</script>

 

In this example, a cart is deemed abandoned if the user does not complete it in 30 minutes. You can change that to any number you want (60 = 60 minutes, 120 = 2 hours, etc)

Step 2: Cart Completion Listener

Next, place the following code on your "order complete" or "thank you" page.

<script>
_at.track("cart", {"type" : "order-complete" });
</script>

 

Step 3: Create Triggered Campaign

After you add those you will start seeing "Abandoned Cart" events start showing up in your event logs and you can create the triggered campaign to send notifications those who trigger it. It's usually easiest to let the code run for 24 hours so that you can easily see the events being logged in your dashboard ("Logs" > "Event Logs"). Once you are ready you may proceed to adding custom event triggered notifications.

 

Additional Notes

By default, only one abandoned cart will be tracked per subscriber per day. This is done to prevent the potential notification loop that could occur if the user clicked an abandoned cart notification and then did not purchase an item, effectively restarting the abandoned cart logic.

If you'd like to listen for an abandoned cart more than once per day (say, for instance the user updates their cart after clicking the original abandoned cart notification) you can call the following javascript function which will reset the abandoned cart listener:

<script>
_at.track("cart", {"type" : "cart-updated" });
</script>