Abandoned cart tracking allows you to measure how many visitors/customers leave the portal before completing a purchase, leaving items in the cart. When a customer leaves a hosted page/ checkout page unattended for some time, it is counted as an Abandoned Cart. Read more about it here.
Chargebee generates a report to track the abandoned carts. You can view this at Reports > Revenue Recovery > Abandoned Carts.
To track abandoned carts via API, a new attribute is added in the Hosted Pages resource called checkout_info. This attribute persists the end customers actions and customer entered information during the checkout process and it is logged for every 5 sec. For every action performed in the hosted pages, the updated_at and state attributes will be updated.
You can filter the data with the attributes below:
- updated_at - timestamp indicating when this hosted page was last updated
- state - mentions whether the checkout was successful or not (actual values are created, requested, succeeded, cancelled, and acknowledged)
- type - can be set to checkout_new or checkout_existing based on the type of customers you are trying to track
A combination of updated_at, state, type as well as list_hosted_pages API helps in identifying the customers who had abandoned the cart. Poll list_hosted_pages API regularly with:
updated_at set to a specific time range
state = "requested"
type = "checkout_new" or "checkout_existing"
The checkout_info attributes will have the information about the customer (email address, first name, and last name) which you can retrieve and utilize for retargeting and failure reason (if any).