Used for:
- Message Content
- Building Audiences
- Analytics
Overview
Order data is stored in the orders collection. This collection contains all data associated with a purchase event. The most common order related attributes are required by default. These required fields include email, order ID and purchase date. The items object is optional but if included, product ID, SKU, category, and name item fields are required. Some attributes are set as arrays and can include customizable name/value pairs such as color:blue, size:large, etc. For more information on order attributes and requirements read about order data and the API.
Order data can be used to personalize content in a message and to build an audience.
How Orders Are Stored
Below is a simple example of an order stored in the orders collection as a JSON object.
[ { "orderID": 1, "cID": "55d7294629aa544d75c6b810", "purchaseDate": "2015-10-29T15:05:00+0000", "properties": { "custom_order_key": "custom_order_value" }, "items": [ { "productID": "1", "sku": "sku", "model": "mymodel", "category": "garment", "name": "dress", "qty": 1, "amount": 2.5, "attr": { "color": "blue", "size": "xs" }, "properties": { "custom_order_item_key": "custom_order_item_value" } } ] } ]
The example above includes the reserved fields productID, sku and category as well as an object of customized attributes: color and size.
Importing Orders
Order data is imported into Cordial via the API Learn more about order collections and the API.
or via the JavaScript listener.
Viewing Orders
Using an API call
An order collection can be viewed via an API call.
To view an orders collection via an API call, read the article about order collections and the API.
Using Message Preview
You are able to view the orders specific to a contact using a Smarty utility. Simply paste the following code into an HTML message and click the preview button to see all the orders for the previewed contact:
{$orders=$utils->getOrders()} {$utils->jsonPrettyPrint($orders)}
Using Orders in a Message
Message content can be personalized with order data using the Smarty getOrders method.
For example, a contact could be sent a message with information on the products they ordered. When displaying product meta data related to an order (images, descriptions, etc), it is recommended to pull that data from the product catalog as it may be more up to date.
Building Audiences with Orders
Using the audience builder, you can create audiences of contacts that purchased a certain product. Additional properties about the product can be used to filter the results.
The image below shows the audience rule associated with orders.

For example, you could create an audience of all contacts that have purchased the Super Drill 3000 within the past 30 days and send them a personalize message with recommended product accessories or related products from your catalog.

Building Analytics Reports Using Orders
Audiences based on orders 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
Using audience trend reports, you can view the population of an audience over time based on their order history.
For example, you can create an audience based on if a contact has made a purchase in the last 30 days, 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 orders in event dashboard charts using audience filters.
For example, you can create a chart that plots message activity over time filtered by a saved audience rule where the contact has placed an order in the past 30 days.

Filter Event Data Reports
Event data reports allow you to view reports of event activity. You are able to filter reports using audience rules much the same as event dashboards.
For example you can filter by a saved audience rule where the contact has placed an order in the past 30 days.

In the next article learn about supplements.
Comments
0 comments
Please sign in to leave a comment.