Order Interaction

An order interaction is an ecommerce event that captures actions performed by a user to manage new, in progress, or completed orders.
The interaction names are treated as an order interaction:
Name Value
SalesforceInteractions.OrderInteractionName.Cancel Cancel
SalesforceInteractions.OrderInteractionName.Deliver Deliver
SalesforceInteractions.OrderInteractionName.Exchange Exchange
SalesforceInteractions.OrderInteractionName.Preorder Preorder
SalesforceInteractions.OrderInteractionName.Purchase Purchase
SalesforceInteractions.OrderInteractionName.Ship Ship
SalesforceInteractions.OrderInteractionName.Return Return
1{
2   interaction: {
3        name: 'Purchase',
4        order: {
5            id: '9432',
6            totalValue: 9.99,
7            currency: "USD",
8            lineItems: [{
9                catalogObjectType: 'Product',
10                catalogObjectId: 'product-xyz',
11                quantity: 1,
12                price: 9.99,
13                attributes: {
14                    giftWrapping: 1
15                }
16            }]
17        },
18        attributes: {
19            promoCode: "SAVE10"
20        }
21    }
22}
Order interaction fields:
Field Name Field Type Description
name string Required. The event names.
order.attributes object A user-supplied value.
order.currency string The currency of the order.
order.lineItems Line Item Data An array of Line Item Data values.
order.id string Required. A unique identifier representing the order.
order.totalValue number Required. The total value of the order.

Example

Here’s how an order interaction is captured using the Web SDK.

1SalesforceInteractions.sendEvent({
2   interaction: {
3        name: 'Purchase',
4        order: {
5            id: '9432',
6            totalValue: 9.99,
7            currency: "USD",
8            lineItems: [{
9                catalogObjectType: 'Product',
10                catalogObjectId: 'product-xyz',
11                quantity: 1,
12                price: 9.99,
13                attributes: {
14                    giftWrapping: 1
15                }
16            }]
17        },
18        attributes: {
19            promoCode: "SAVE10"
20        }
21    }
22})

Here’s how an order interaction is captured using the Sitemap.

1SalesforceInteractions.init().then(() => {
2   const sitemapConfig = {
3        global: {},
4        pageTypes: [{
5            name: 'product_detail',
6            isMatch: () => true,
7            interaction: {
8            name: SalesforceInteractions.OrderInteractionName.Purchase,
9                order: {
10                    id: '9432',
11                    totalValue: 9.99,
12                    currency: "USD",
13                    lineItems: [{
14                        catalogObjectType: 'Product',
15                        catalogObjectId: 'product-xyz',
16                        quantity: 1,
17                        price: 9.99,
18                        attributes: {
19                            giftWrapping: 1
20                        }
21                    }]
22                },
23                attributes: {
24                    promoCode: "SAVE10"
25                }
26            }
27        }]
28    }
29    SalesforceInteractions.initSitemap(sitemapConfig)
30})