Overview
Cart items consist of data about items placed in the shopping cart by visitors on your website. These items are stored with each contact in Cordial's Contacts Collection along with contact attributes and list membership.
Cart items are normally passed using the JavaScript listeners cartitem method on your website. They can also be passed using the cartitems API call. Regardless of the method used, you can pass information about the cart item such as productID, sku, category, image urls, and more.
Cart times can be used to build audiences and analytics reports, as well as personalize message content.
How Cordial stores cart items
Cart item data is stored as a JSON object in the contact record. Below is an example of a contact record containing the cart item object. The cart item object is highlighted for easier visualization.
The cart item contains the required fields of productID, sku, category, and name along with the optional fields of description, price, url, and images. Amount totals are calculated automatically.
[{ "channels": { "email": { "address": "fredgarvin@example.com", "subscribeStatus": "subscribed", "unsubscribedAt": "" } }, "gender": "Male", "last-name": "Fred", "first-name": "Garvin", "cart": { "cartitems": [{ "productID": "About Last Night", "sku": "26616383623", "category": "shirts", "name": "Back Off Polo", "qty": 2, "description": "Robert Graham - Back Off Polo Your style goes around and around! Classic styling Clean lines Brand mark logo on center 50% 50% mix Washable Imported. Measurements: Length: 10 Product measurements were taken using size MD. Please note that measurements may vary by size.", "itemPrice": 98, "url": "https://cordialthreads.myshopify.com/?exitintent", "images": [ "https://cdn.shopify.com/s/files/1/1070/1848/products/3705707-p-MULTIVIEW.jpg?v=1470290687" ], "amount": 98, "properties": { "custom_key": "custom_value" } }], "totalAmount": 98, "lm": "2018-03-28T18:13:06+0000" }, "_id": "58d2fc99ac0c8117814d4e78", "lastModified": "2017-03-22T22:37:13+0000", "createdAt": "2017-03-22T22:37:13+0000" }]
You can learn more about the cart item schema and parameters in the API documentation here.
How Cordial creates cart items
Cart item data is created in Cordial by either JavaScript listeners on a website or via an API call.
View cart items
Cart item data is viewable in the API or by rendering cart items in a message using Smarty.
View cart items using the API
To view cart item data in the API, use the GET /contacts or GET /contacts/{primary_key} API calls.
View cart items in a message preview
The following Smarty will render cart items (in JSON format) within a message, given that the contact being previewed has items in their cart.
{$utils->jsonPrettyPrint($contact.cart.cartitems)}
Use cart Items for message content
With Smarty, you can render cart items in a message using the foreach statement. This is useful in an abandon cart campaign when you want to show contacts what items are currently in their cart.
You can use the following code to display the items currently in a contact's cart (given that the cart data exists in the system).
You left the following items in your cart:<br>
{foreach $contact.cart.cartitems as $item}
<b><a href="{$item.url}">{$item.name}</a></b><br>
SKU: {$item.sku}<br/> Description: {$item.description}<br>
Qty: {$item.qty}<br/> Price: {$item.amount}<br><br>
<a href="{$item.url}"><img src="{$item.images.0}" /></a><br>
{/foreach}
Below is an example of rendered message content displaying a user's cart items.
You can learn about creating an abandon cart automated message here.
Build audiences using cart items
Using the Cart audience rule, you can build audiences based on the items in a contact's cart.
1. Navigate to Contacts > Audience and edit or create a new audience.
2. Select Cart from the Rules dropdown in the Audience Builder.
Use caseYou can create complex segmentation queries by combining cart item audience rules with other rules to create queries such as: "Show me all male contacts that have put more more than $40 of Shirts in their cart."
You can learn more about the audience builder here.
Build analytics reports using cart items
Audiences based on items in a cart can be saved as audience rules and either visualized over time with audience trend reports or used as filters for event data dashboards and event data reports.
Audience Trend reports
To access audience trend reports, log in to Cordial and navigate to Analytics > Audience Trends.
Use caseYou can create an audience based on if a contact has items in their cart, enable audience trend analytics on the audience rule, then view the population over time on an audience trends chart.
Filter Event Dashboards
Event Dashboards provide a way to visualize event activity over time by creating customizable charts. You can take advantage of cart items in event dashboard charts using audience filters.
To edit an event chart (also called a time series chart), navigate to Analytics > Event Dashboards and select Chart Settings in the upper right corner of the chart.
Use caseYou can create a chart that plots message activity over time filtered by a saved audience rule where the contact has items in their cart.
Filter Event Data Reports
Event Data Reports—navigation: Analytics > Event Data Reports—allow you to view reports of event activity. You can filter reports using audience rules similar to the event dashboard charts.
Use caseYou can filter by a saved audience rule where the contact has items in their cart.
In the next article, you can learn about events.
Comments
0 comments
Please sign in to leave a comment.