We’ve migrated our documentation to a new site, which means some URLs have changed.
Subscriptions

How to send an email to users who abandoned checkout?

Required licenses:

  • ESP

  • Subscription Management + Billing

If you'd like to send an email to users who abandoned the Subscription Management + Billing checkout, you can do so by following the below steps. An ESP license is required as well as that the user is logged in.

1. Identifying that a user abandoned checkout
This can be done using the JavaScript callback checkoutClose and checking for the option event.state=close. The event object includes information about whether or not a purchase occurred before the modal closed. This means that the user closed checkout without completing the purchase.

2. Sending an email to the user
You will need to create a Triggered campaign in ESP as this campaign type implies automated content distribution based on the event of new/old subscriber additions to the list. For this campaign type, we will send the newsletter to a subscriber as soon as they are added to a relevant mailing list. More information about this is available here.

Once the campaign is created, you will need to create a corresponding mailing list for this campaign. The campaign will have static content and contain an email layout that you want to send to users abandoning checkout.

When users abandon checkout, you will use our JavaScript function provided here to add the user to the mailing list for the Triggered campaign you created. The user will immediately get the email.

The full JavaScript code will look like this:

tp.push(["addHandler", "checkoutClose", function(event) {    // The event object contains information about the state of closed modal
    switch (event.state) {
        case 'close':
            if (tp.pianoId.getUser()) {
                window.PianoESP &&
                    "function" == typeof window.PianoESP.handleUserDataPromise &&
                    window.PianoESP.handleUserDataPromise({
                        email: tp.pianoId.getUser().email,
                        squads: [mailing_list_ID0]
                    });
            }
            break;
    }
}]);

You can add this code to your Composer integration script, you will just need to replace the mailing_list_ID0 with the mailing list ID you've created and attached to the triggered campaign.

Users can unsubscribe from these campaigns by clicking on the "Unsubscribe" link in the footer of the email received.

Last updated: