How can we help?

Abandoned cart message

Overview

A cart event trigger initiates an automated message that targets a customer who shopped on your website, added items to their cart, and then abandoned the shopping experience.

The abandoned cart message can be delivered automatically, and in a truly personalized fashion, to promote each of the unique items that were left in the cart. This may include images of the product, links back to the cart or product page, and descriptions of the product.

You can incentivize customers with a discount, free shipping, or a call to action that rekindles their interest. The abandoned cart email, although a lower volume campaign, can yield high engagement and a great conversion rate.

Implement the trigger

In order for the abandoned cart message to send, there needs to be data sent to the system that will trigger the automation. In the case of an abandoned cart message, we'll use the trigger of when a contact adds an item to the cart. If the item is ordered, we'll cancel the message based on an order event.

This strategy utilizes three primary pieces of data:

1. Cart attribute

  • Purpose: Used to personalize the body of the message with the actual items left in the cart.
  • Data type: An object stored as contact attribute data. The object contains an array of objects, each describing the items in the cart.

2. Cart event

  • Purpose: This named event is used to simply trigger the actual message sending process. It's not necessary to pass any properties along with this event because the details of the cart will be written to the cart attribute above.
  • Data type: Event data stored in the Contact Activities collection.
Note: The actual name of the event is up to you, but we typically recommend "cart."

3. Order event

  • Purpose: This event will be used to cancel the message sending process if a purchase occurs during the time between the cart event and the message send (per the custom delay).
  • Data type: Event data stored in the Contact Activities collection.
Note: The actual name of the event is up to you, but we typically recommend "order."

Implementation methods

There are two implementations you can use to send the data to Cordial:

JavaScript Listener implementation

This method assumes the user's browser has a cookie that holds the necessary contact identification data. There are two ways this cookie may be set.

Note: This article assumes you have implemented the JavaScript Listener v2. We have included examples applicable to JavaScript Listener v1 in case you're not using v2 at this time.
  1. A cookie will be set when a contact arrives on the site via a tracked link clicked from an email. In this case, a first-party cookie is automatically written with the necessary information to identify the contact.
  2. The second way a cookie may be set is by calling a basic identification function in JavaScript. When a customer logs into a site/store or provides their email address via a form submission (ex: newsletter sign up form), a function may be called to pass the email address to Cordial. The crdl(contact) method can set the cookie and add or update a contact record.
    crdl('contact', auth_data, contact_data);

    In JS listener v1, the cordial.identify sets the cookie and the cordial.contact adds or updates the contact record.

    cordial.identify(emailaddress);
    cordial.contact();

    Learn more about the crdl(contact) method here.

When a cart is updated, run the following functions

crdl([
    ['cart', 'clear'],
    ['cartitem', 'action' , cart_data], 
    ['event', 'cart']
]);
cordial.event('cart');
cordial.clearcart();
cordial.cartitem('action',[array of cartitemObjects]);

There are two possible actions for the crdl(cartitem) method:

  • add: add a new cart item record or increment the quantity of an existing record.
  • remove: remove an existing cart item (supports a single object of cartitems).

You can find full details on working with a single or array of cart items here.

Best practice for managing the cart state: Although we do support the ability to add or remove individual items to the cart object, most implementations simplify management of the cart state by calling ['cart', 'clear'] and then ['cartitem', 'add' , cart_data] on each cart event, effectively clearing and repopulating the entire cart object. This assumes the front end has access to all the items in a given cart.

When an order is placed (checkout), run the following functions

crdl([
    ['cart', 'clear'],
    ['order', 'action' , order_data], 
    ['event', 'order']
]);
cordial.clearcart();
cordial.order('action',orderObject);
cordial.event('order');

You can find full details on the order object here.

Note : The ['event', 'order'] call is optional, and not required for cart abandonment. However, we highly recommended that order data is passed using either this method or the REST API to take advantage of segmentation by purchase behavior.

REST API implementation (server-side alternative to JavaScript)

This method assumes the contact has been identified as part of the session.

Note: The REST API implementation is an alternative method to the embedded JavaScript Listener. This is a server-side approach to sending the same data.

Methods to call when a cart is updated:

Methods to call when a purchase occurs:

Create an automated message

Now that you have the appropriate data points (passed by either the JavaScript Listener or REST API), you can can set up the event triggered automation template.

1. From the Cordial Dashboard, navigate to Message Automation > Create New Automation.

2. Provide the necessary information and click Continue.

3. Under the Sending Methods panel on the left, click Event Triggered.

4. For Trigger event, choose Custom event and select cart.

Note: The cart option will appear in this menu as soon as the first event has been passed to the account).

5. For Delivery time choose Delay sending. Set the Delay to 2 hours (or whatever interval makes sense for your shopping experience).

6. For Handling events triggered during delay, there are a series of conditions that can be set.

  • For the first condition: If cart Then select Restart delay time. This ensures the full two-hour delay is respected if other cart events occur after the initial event.
  • Add a second condition: If order Then select Cancel sending. This ensures that the cart abandonment email is not sent if the customer actually completes the order before the delay time ends.

7. For How often can this message be sent to an individual select Custom interval and set as 1 time(s) per 7 days. The frequency limit can be set to whatever interval makes the most sense for the shopping experience you want to create. We recommend limiting these triggers to a once a week.

8. Save the trigger setting.  

9. Once this is saved and the message content is published, you can Enable the message. As soon as the message is enabled, the triggers are active and will send the message according to the rules applied.

Code the Message Content

The following is a very simple example of the Smarty script for printing the cart items in the body of the message. Apply markup and styling according to your brand or style guide.

You left the following items in your cart:<br> 

{foreach $contact.cart.cartitems as $item}
<b><a href="{$item.url}">{$item.name}</a></b><br>
SKU: {$item.sku}<br/> Description: {$item.description}<br>
Qty: {$item.qty}<br/> Price: {$item.amount}<br><br>
<a href="{$item.url}"><img src="{$item.images.0}" /></a><br>
{/foreach}

Once your draft is tested and ready to be published, publish the content, set the headers, and enable the trigger sending method. Your abandoned cart email will be enabled and active.

In the next article, you can learn how to set up an order confirmation message.

Comments

0 comments

Article is closed for comments.