Menu
 

Cart Abandonment

Introduction

Whether you’re an e-commerce company, or a product company, the techniques used for cart abandonment will help you increase completion rates in any flow where you have drop off. One of the most powerful concepts you’ll learn is how to store context on a profile for easy recall and personalization later.

This recipe is slightly technical. We’ll walk through sending cart data to Customer.io, clearing the cart when someone purchases, setting up rules to trigger a message when a cart is full, and personalizing a message with information from their cart. You’ll want to be comfortable with copying and pasting commands in to the terminal window (with minor editing), as well as writing some liquid templating in to the Customer.io editor.

Ingredients

  • Your API key and secret from your Customer.io account
  • Terminal window and basic knowledge of cURL
  • Optional: Text editor

Method

In Customer.io, you’ll store two types of information on a person: attributes and events. A common way people try to do abandoned carts is using events. However, the most flexible way to do it is with attributes and there are few steps:

The Cart

Store the cart on the user

We recommend storing the cart as part of the user’s attributes in Customer.io. You’ll store it as structured data… probably something like:

Cart: {

[

{item_name: Hat, item_price: 22},

{item_name: Scarf, item_price: 11}

]

}

Set the cart using curl:

curl  -i https://track.customer.io/api/v1/customers/customerid    -X
PUT    -H "Content-Type: application/json"    -u
your_site_id:your_api_key    -d '{"cart":[{"item_name": "hat",
"item_price":22},{"item_name": "scarf", "item_price":11}]}'

This structure is an array of hashes. By storing the data this way you can email the user and merge in data from their cart.

Clear the cart when the user checks out

We’ll trigger our abandonment email by detecting that there’s something in the cart. If there’s nothing in the cart i.e. the user purchased, or otherwise emptied their cart, then we don’t want to send the email.

Cart: “”

Create Your Segment

Create a segment for people with something in the cart

Then, use this segment as the trigger for the campaign.

People will match this campaign immediately when they add something to the cart. So make sure you add enough time in your Workflow to allow them to complete checkout.

Add your delay

You might want to add something like a 45 minute delay and then 1 email, or add several delays and several emails.

If the user clears the cart at any time, the emails will stop.

Create your abandonment email

Hi Friend,

Your cart contains:

{% for item in customer.cart %}{{ item.item_name }} - {{ item.item_price }}

{% endfor %}

In our simple example, this will render like the email below:

You can use this basic structure to store lots of data as customer attributes and merge in things like a picture of the item in the cart, a link to the item, etc.

Other considerations

An admin setting exists to allow campaigns to “rematch” after a certain amount of time. This may be a good candidate to enable that. Reach out to our support team to turn this on for your campaign.

Wrap Up

Abandoned carts are a great way to think about any workflow where someone doesn’t complete the steps you were hoping they would. If you have questions about how to apply this to your business, send us an email.