Cart Abandonment is any representation of a visitor adding items to the cart and not purchasing. This post describes how to setup Cart Abandonment within AudienceStream. The example discussed below will explore the use case where a visitor adds a product to the cart and then the session ends without an order completion event. Another basic example is when the visitor is on the Cart page and then exits back to the Marketing pages.
If tracking the click event of a product being added to the cart, a utag.link() call is required so that the event and product information can be sent to AudienceStream. Here is a sample jQuery onHandler extension that shows the event and product information being declared.
The utag.link() will trigger the DataCloud tag to fire and automatically send this information even if no tags fire.
Note: No matter the cart action, the product information needs to be made available. This is because Cart Abandonment is usually tied to an email campaign which will reference the products added to the cart. The product information will help the user be targeted correctly.
*Added July 14, 2014
As clients have began to take a shot at implementing rules and attributes, there have been some incorrect implementations. Below a modified badge transformation of one such Cart Abandonment campaign. While correct in the sense that it is looking to see if the current page is the free trial page and the confirmation page isn't viewed, it is still incorrect because this badge would be applied on the free trial page without taking any later page views into consideration. If a later page view is the receipt page the badge would incorrectly still be applied.
Therefore tracking each page view separately with a flag and then viewing the flag's state at the end of the session will be the correct logic. Here is how that is done.
First, create a rule that determines when an Add to Cart event occurred. Looking at the onHandler above we can use the "as_event_type" parameter and when it equals "addproducttocart" we know it's the correct event.
Second, create a rule that determines when an Order has been completed. This logic was copied directly from the Order load rule in Tealium iQ.
Create a Flag attribute titled "Add to Cart". We will need to apply two transformations to the Flag:
Our first Transformation sets the "Add to Cart" to flag at the beginning of every new visit (session). The logic is "any time a new visit occurs set the flag to 'False'".
The second Transformation sets the "Add to Cart" flag to "True" any time an Add to Cart event occurs.
This allows us to distinguish at the visit level whether or not an Add to Cart event occurred.
Next, we need to create Transformations for our "Order Complete" Flag. The first transformation, similar to the first transformation on the "Add to Cart" flag will set the "Order Complete" flag to false at the beginning of every new visit.
The second transformation for "Order Complete" will set the flag to "True" when a visitor reaches the Order Confirmation page.
This allows us to distinguish at the visit level whether or not an Order has been submitted.
Now that we have the basics in place to track an Add to Cart event and Order Complete event, we can build the logic to determine the Cart Abandonment.
The logic is: "If an Add to Cart event occurred and at the end of the visit there is not an Order Complete event then apply the Badge."
To create the above logic, we need to set up two more rules:
First, create a new rule called "Cart Abandoned" where the "Add to Cart" flag is "True" and the "Order Complete" flag is f
Now create a Badge named "Cart Abandoner" that is applied when the "Visit ended" and the Cart Abandoned rule is evaluated to true.
Now that the Badge has been applied, an Audience needs to be created so that a Service can take action. In the drop-down next to the "Add Filter" button, select the "Cart Abandoner" Badge and add the filter. Give the Audience a name such as "Cart Abandoners".
Now that an Audience has been created, any Service can be configured to use the Audience. Other posts describe creating a Service in detail.