How to Recover Abandoned Carts in Sitecore OrderCloud with Sitecore Send

Did you know that the average cart abandonment rate is a whopping 69%! Given that 45% of cart abandonment emails are opened, 21% are clicked on, and 50% of the users who do click eventually go through with the purchase, it's a no-brainer that you need a solid re-targeting strategy to recover abandoned carts. Moosend has summarised some very interesting facts in the infographic below.


In this post, I'll show you how you can easily create and implement abandoned cart emails in Sitecore OrderCloud using Sitecore Send (Moosend).

Sitecore OrderCloud is an API-first, headless commerce cloud platform for B2B, B2C, and B2X. If this is the first time you've heard of Sitecore OrderCloud or just haven't setup a sandbox yet, have a look at my posts here and here first.

Moosend, which was recently acquired by Sitecore, is a highly rated email marketing and automation platform used by some of the leading brands worldwide.

Setup Sitecore OrderCloud Storefront (Optional)

You can skip this section if you already have an existing ecommerce website/storefront that you want to integrate Moosend with. Otherwise, have a look at my post here on how you can quickly deploy a high performance Next.js Commerce storefront with Vercel using Vercel's Sitecore OrderCloud integration.

Create a Free Sitecore Send (Moosend) Account

Head over here and follow the prompts to create and setup your free Moosend account.

Create Account

Create an Abandoned Cart Automation

Follow the steps here to create an abandoned cart automation in Moosend using an intuitive drag and drop interface. The guide will take you through the following steps:

  • Setting up a trigger for the automation
  • Adding a wait interval to the automation to give the user time to purchase what's been added to the cart
  • Checking if a user has gone through with the purchase within that interval
  • Sending an abandoned cart email to users who have not gone through with the purchase

Alternatively, you can skip this and just select the Abandoned Cart recipe when adding a new automation from in the Moosend Dashboard. Note that this is sample automation, and you can always tweak it based on your specific requirements.

Create Abandoned Cart Automation

I would recommend going through the step by step guide at least once just to understand how to create an automation from scratch. Once, you've setup the automation, you'll have something like this:

Abandoned Cart Automation

You'll notice that there are some additional tasks that need to be done if you use the pre-built recipe:

Pending Tasks for Automation

To complete this, you need to click on the prompts shown above and set the following:

  1. Set the email Subject line
  2. Select the email "From" name. Follow the guide here to setup a Sender if you don't have one already.
  3. Create the campaign content. There are multiple options here. For now, you can just crate it using the Rich Text Editor.
  4. Set the number of emails to send per day
  5. Connect your website to Moosend by following the guide here. I used the custom installation script that you can insert in your website Head tag. Have a read through the section below on how to get your ecommerce storefont up and running. Once you've added the tracking code, click on the 'When someone adds any product to their cart' box in the automation and select the website from the dropdown.

Add Action Tracking Code to Website

Finally, you need to add some JavaScript code to you website to track the user's actions in order for the abandoned cart automation to work. This makes use of the Moosend tracking script added when you connected your website in step 5 in the previous section. The 3 steps below are the minimum required, however you may also track custom events to create more complex re-targeting strategies.

Identify User

Moosend needs to know who the user is that is being targeted. For this, you need to initiate tracking as soon as you have an email- this could be when the user signs in, creates a new account, subscribes to a newsletter, or provides details during a multi-step guest checkout.

// identify with email
mootrack('identify', 'john@doe.com');

// identify with email and name
// commented out as you need to choose one of these calls only
//mootrack('identify', 'john@doe.com', 'John Doe');

Track Add to Cart

Moosend needs to know when the user adds something to the cart. To do this use the following code snippet.

// mandatory - a unique code for the product, like its SKU
var itemCode = 'COW-T-SHIRT';
// mandatory - the name / title of this product
var itemName = 'Cow T-Shirt'; // mandatory
// mandatory - the image url of this product
var itemImage = 'http://your.store/product-color-blue.jpg',
// mandatory - the price of this product
var itemPrice = 12.02;
// mandatory - the url to get to the relevant product page
var itemUrl = 'http://your.store/product-101',
// mandatory
var itemQuantity = 2;
// mandatory - the total price for purchasing the given quantity of this product
var itemTotalPrice = 24.04;
// optional - the category of this product
var itemCategory = 'T-Shirts';
// optional - the manufacturer, brand name or company / owner of this product (if any)
var itemManufacturer = 'Acme Co';
// optional - the supplier of this product (if any)
var itemSupplier = 'Supplier Co';

// you can add custom properies and later use them in segmentations or automations
// You can track things like the color or the sze of the t-shirt in this case
var extraProps = {'color': 'Red', 'size': 'XXL'};

// Tracking add to cart events with mandatory arguments
mootrack('trackAddToOrder', itemCode, itemPrice, itemUrl ,itemQuantity);

// Tracking add to cart events with mandatory arguments + optional
// commented out as you need to choose one of these calls only
//mootrack('trackAddToOrder', itemCode, itemPrice, itemUrl, itemQuantity, itemTotalPrice, itemName, itemImage, extraProps);

Track Order Completed

Finally, you also need to let Moosend know if the user has gone through with purchase or not. In order to do this, make sure you send an order completed event once the user has successfully completed the purchase.

// send order completed events
var product1 = {
    // mandatory - a unique code for the product, like its SKU
    itemCode: 'COW-T-SHIRT',
    // mandatory - the name / title of this product
    itemName: 'Cow T-Shirt',
    // mandatory - the image url of this product
    itemImage: 'http://your.store/product-color-blue.jpg',
    // mandatory - the price of this product
    itemPrice: 12.02,
    // mandatory - the url to get to the relevant product page
    itemUrl: 'http://your.store/product-101',
    // mandatory
    itemQuantity: 2,
    // mandatory - the total price for purchasing the given quantity of this product
    itemTotalPrice: 24.04,
    // optional - the category of this product
    itemCategory: 'T-Shirts',
    // optional - the manufacturer, brand name or company / owner of this product (if any)
    itemManufacturer: 'Acme Co',
    // optional - the supplier of this product (if any)
    itemSupplier: 'Supplier Co',

    // you can add custom properies and later use them in segmentations or automations
    color: 'Red', // You can track things like the color
    size: 'XXL' // or the size of the t-shirt in this case
};

// Products should be an array with an object like product.
var products = [product1, product2, ....];
mootrack('trackOrderCompleted', products);

Activate Automation

Now that you've wired everything up, all you need to do is activate the automation by turning on the toggle and you're all done!

Just sit back and watch your revenue grow...


References

https://moosend.com/blog/cart-abandonment-stats/

https://moosend.com/blog/cart-abandonment-rate-infographic/

https://www.sitecore.com/products/send

https://moosend.com/cart-abandonment/

https://help.moosend.com/hc/en-us/articles/115002423189-How-can-I-create-an-Abandoned-Cart-automation-

https://moosend.com/recipe/abandoned-cart/

https://help.moosend.com/hc/en-us/articles/115002454009-Ηow-can-I-install-website-tracking-by-using-the-JS-tracking-library-

https://moosend.com/blog/abandoned-cart-email/

https://academy.moosend.com/lessons/how-to-automate-an-abandoned-cart-email/