Skip to main content

Abandoned cart scenario: how to use apicontent

Description

Visitors to an online store often add items to their carts but do not place an order. However, if you remind them about the abandoned items after a while, the chances of completing the purchase will increase. This guide is here to help you set up a short scenario that will automatically send reminder emails to your customers.

Step 1: Place tracking pixels on website pages

Let's say that a user adds items to the cart, goes to the cart, pays for the purchase and then is redirected to a thank-you page. A subscriber will receive a reminder about the abandoned cart if they visit the cart page, but do not get to a thank-you page afterwards, i.e. do not complete the checkout. Pixels will help you track visits to certain website pages.

In the Pixels section, create 2 pixels:

  • Online store - Cart: it tracks visits to the cart page

  • Online store - Thanks: it tracks visits to a thank-you page

tip

In some situations, a website visitor may open the cart several times. If you don't want to spam your client's email by sending several reminders in one day, block reactivation of the pixel for the cart for 1440 minutes (24 hours).

To view the pixel code, click “Get pixel code". Copy the code from the window and place it on the website pages:

Step 2: Configure customer profile capture

Create a new scenario and set the basic settings:

Next, specify the database — the profiles of these customers will be included in the scenario if the capture condition is met. Select the event that must happen for the profile to be included in the scenario. In our case, it's pixel activation. This pixel is the one you placed on the shopping cart page (Online Store — Cart).

Select what to do with the profile if a website visitor visits the cart page several times. Each time the pixel will be activated. In this case, the user may receive more email reminders than he'd like. To avoid this, restart scenario on reentering.

Step 3. Set up a workflow for the profiles that have completed their orders

Add a Pause node and specify waiting time, e.g. 1 hour. In this case, the profile captured in the scenario will move to the next stage only in an hour.

Next, add a Condition node to check whether the user has made a purchase. The condition will be met if they go to a thank-you page, i.e. the "Online store — Thanks" pixel is activated:

If the customer has made a purchase, give him bonus points. To do this, there should be a custom field (type — number) in the profile database, e.g. bonus_points. Add an Update data node to the scenario and increase the value of the field:

tip

To change the number of bonus points depending on the purchase price, use the "take the value from the field {apicontent}" action instead of "increase by''. To do this, add an API call node in the previous step and save the http response with necessary data.

So, the positive development of the scenario is ready:

Step 4. Set up a workflow for the profiles that have left the website

Let's go back to the customers who left the website without completing the order. After a condition node, the scenario will redirect them down the red branch.

Now you need to transfer data about the abandoned items to the platform using an API call and then add this data into an email template. To do this, add an API call node. Specify the URL where the data about the products in the cart is located. The request method — GET.

Next, activate the "Save the http response in {apicontent} field" field and enter the name of the field in which the response will be saved. You can enter any name, for instance,cart_items. This field will be used when substituting a variable into the template.

Add the necessary request parameters, for instance, ID or email of the profile, using which you can find the desired cart.

All you have to do is add a Channels node. To do this, you need to prepare a message template. For now, save the scenario at this stage.

Step 5: Create an email template

Go to the Templates section and create a new template for the email sending channel:

The content of the email should be dynamically updated depending on the recipient. The {apicontent} variable is used for this. It stores the data that you receive using an API call node. For example, a JSON object with data about products in the purchaser's cart.

Example of a JSON cart
[
{
"product_id": 1,
"product_name": "T-Shirt",
"product_price": "20.00",
"product_quantity": 1,
"product_image_url": "https://example.com/pic/jersey.png"
},
{
"product_id": 2,
"product_name": "Hoodie",
"product_price": "50.00",
"product_quantity": 1,
"product_image_url": "https://example.com/pic/hoodie.png"
}
]

Once you've saved a JSON object in the apicontent field, you'll have access to the elements of this object by key. For example, {apicontent.cart_items.field_name1}. To add a variable,select from the list (</>) Services → API content.

If the product data is in an array, use loops:

In your cart:

{for $i $item = apicontent.cart_items}

<p><img src="{$item.product_image_url}"/></p>

<p>Name: {$item.product_name}</p>
<p>Quantity: {$item.product_quantity}</p>
<p>Price: {$item.product_price}</p>

{end}

<!--{unsubscribe} -->

Step 6: Check the preview of the apicontent variable

When adding the apicontent variable, the message preview will not work because the variable doesn't contain any information. If you want to know what message will look like, set up the preview window.

Open the preview mode and find "Configure API content" below. Add a JSON object similar to what you'll receive after the API request in the scenario.

Please note that the test array of products must be stored in the cart_items field.

Click on the check mark. The values of the field will be added to the template.

Go back to the scenario and add one of Channels node. Select the created template in the settings:

Step 7. Activate the scenario and evaluate its effectiveness

The finished scenario looks like this:

The scenario can be expanded. For example, if the subscriber has not completed the purchase, give them a promo code or send a compilation of related products.

Activate the series and save it. You can evaluate the effectiveness of the scenario in the node editor or in the summary report.