How can we help?

Orders

Overview

Order data is stored in the orders collection. This collection contains all data associated with a purchase event. Order data can be used to personalize content in a message, trigger messages, and build audiences.

For more information on order attributes and requirements, you can read about order data and the API.

How Cordial stores orders

Below is a simple example of an order stored in the orders collection as a JSON object. The example includes the reserved fields productID, sku, and category, as well as an object of customized attributes: color and size.

[
  {
    "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 most common order-related attributes are required by default. These required fields include email, order ID, and purchase date. The items object is optional. If the items object is included, the 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, and much more.

Import orders

Order data is imported into Cordial via the API, or with JavaScript listeners embedded on your site. 

View orders

View orders via API call

An order collection can be viewed with an API call.

View orders via message preview

You can 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)}

Use orders in a message

Message content can be personalized with order data using the Smarty getOrders method.

Use case

You could send a contact a message with information on products they ordered.

When displaying product meta data related to an order (images, descriptions, etc.), we recommend that you pull that data from the product catalog because it might be more up to date.

Trigger messages when an order is created or updated

You can trigger messages when orders are created or updated. For example, you could trigger a message based on an order's status changing from shipped to delivered. 

1. When creating a message, open the Trigger Events pane and select When an order is created or updated for the Trigger event.

2. Select the Trigger strategy you want to use:

  • Trigger when an order is created or updated.
  • Trigger only when an order is updated (ignore new orders).
  • Trigger only when an order is created (ignore existing orders).

3. Under Changed field, select the event change that will trigger the message, such as when an order's status changes from shipped to delivered. 

4. Add a Conditional filter as needed. 

5. Set the Delay, select whether to Enable quiet hours, and choose How often can this message be sent to an individual.

The $triggerData utility contains both old and new order data, which you can differentiate in Smarty to display additional changes.

Build 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.

1. Navigate to Contacts > Audience and edit or create a new audience.

2. Select Orders from the Rules dropdown in the Audience Builder and drag the rule into your audience.

Use case

You could create an audience of all contacts that have purchased the Vintage Whisper V-Neck Tee within the past 30 days and send them a personalized message with recommended product accessories or related products from your catalog.

Build 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

To access audience trend reports, log in to Cordial and navigate to Analytics > Audience Trends. From here, you can view the population of an audience over time based on their order history.

Use case

You could create an audience based on if a contact has made a purchase in the last 30 days. To do so, enable audience trend analytics on the audience rule, and 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.

To create an event chart, navigate to Analytics > Event Dashboards and select Add Chart.

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 case

You could create a chart that plots message activity over time and is filtered by a saved audience rule where the contact has placed an order in the past 30 days.

Filter Event Data Reports

Event Data Reportsnavigation: Analytics > Event Data Reportsallow you to view reports of event activity. You can filter reports using audience rules similar to event dashboard charts.

Use case

You could filter by a saved audience rule where the contact has placed an order in the past 30 days.

 

Export orders

You can export orders via data job in the UI.

1. Log in to Cordial and navigate to Data Jobs > Create New Data Job

2. Under Export, select Orders

3. Fill in the Name and Tags fields. For Type, choose either One-time or Recurring. Assign a Priority for the job and click Continue.

4. From the Data Job creation page, click Edit in the Data Source pane to specify the orders you want to export.

5. In the Orders pane, configure the orders you'd like to export: specify the actual Orders, Order properties, Item properties (if applicable), Contacts who made the order, and the Date range for when the orders occurred. 

Use case

You could export order data for anyone in San Diego (Order properties) who's ordered a men's dress shirt (Orders) from Cordial Threads (Item properties) within the past 10 days.

6. Select Edit under Data Mapping and enter the required fields: Export name, Export file name.

7. Select Edit under Data Destination and choose the destination for your exported orders file. You can select Local, FTP, SFTP, AWS S3 bucket, Google Cloud, or Azure Blob.

This method of exporting orders automatically prepares that data for the destination you specify above, so you don't need to run an additional data transformation.

8. In the On Completion pane, enter an email address where you'd like to receive a notification once the job is complete. This step is optional.

9. If your data job is recurring, Publish the data job then select Recurring under Settings on the left. From here, set the Schedule for your data job and then Enable it.

10. Run the export events data job. Once completed, you can find the job under the Jobs Widget.

In the next article, you can learn about supplements.

Comments

0 comments

Please sign in to leave a comment.