Order event

An order event (order:confirm) contains details about the purchase a user made on the site. It includes checkout details as well as individual products that were purchased and their details.

An order event can also contain an optional user object that is helpful for mapping the user's real ID to their uuid.

An order event is used to:

  • Calculate overall site level orders and revenue.

  • Calculate revenue-related numbers in Sitecore Discover attribution.

  • Calculate orders, units, and purchase metrics in product and category analytics.

  • Calculate revenue attribution in keyword analytics.

  • Generate top dataset by revenue and co-bought items.

The following table lists the attributes of the order event:

Name

Type

Description

Value

type

String

Required.

Used to identify the type of event.

order

name

String

Required.

Used to identify the event.

confirm

value.products

Array

Required.

Products array having one or more product objects that the user purchased. Used to compute direct attribution numbers in analytics.

For easy processing, the Sitecore Discover system splits the value.products array into individual events called order_split events. For example, an order event that contains two products results in the following events:

One original order:confirm event.

Two order_split events, one for each individual SKU purchased in the order.

n/a

value.products[].sku

String

Required.

SKU of the product the user purchased. Used to calculate direct attribution numbers.

n/a

value.products[].price

Number

Required.

Unit price of the product at which it was purchased after coupons/discounts are applied. Used to compute purchase amount (price * quantity).

n/a

value.products[].quantity

Number

Required.

Number of units of products purchased in this order. Used in calculating Purchase Amount (price * quantity).

n/a

value.products[].price_original

Number

Optional.

The original unit price of the purchased product before coupons/discounts are applied.

n/a

value.products[].store.id

String

Required if order is BOPIS order.

ID of store where an order (BOPIS) is placed.

Note

This is preferred when various products in a single order are purchased in different stores. If all the products are purchased in the same store, it is preferable to pass this information as checkout.store.id.

n/a

value.products[].store.group_id

String

Required if stores are organized in a hierarchy.

An additional identifier, group identifier, for a set of stores.

n/a

value.products[].shipping_method

String

Required if order does not use default shipping method.

Used to identify the type of order. For valid values, refer to Shipping Methods.

n/a

value.checkout

Object

Required.

Checkout object

n/a

value.checkout.order_id

String

Required.

Unique identifier for an order. Used to deduplicate an event based on the order ID.

n/a

value.checkout.total

Number

Required.

Order total including tax, discount, and shipping. Used to calculate overall site revenue and Discover revenue attributions.

n/a

value.checkout.subtotal

Number

Optional.

Subtotal before discount, tax, and shipping.

Used to compare Discover revenue with other third-party web analytics systems that report subtotal.

n/a

value.checkout.store.id

String

Required if order is a BOPIS order.

ID of store where an order (BOPIS) is placed.

Note

This information is present either in checkout or in individual products. When specified in checkout, it indicates that all the products in the order are placed in this store.

n/a

value.checkout.store.group_id

String

Required if stores are organized in a hierarchy.

An additional identifier, group identifier, for a set of stores.

n/a

value.checkout.shipping_method

String

Required if order does not use default shipping

Used to identify the type of order. For valid values, refer to Shipping Methods.

n/a

value.context.user

Object

Optional.

User object that contains permanent user information.

If user is logged in while placing an order, you can send user information as part of the order event. This information might include email, Facebook ID, and so on. It is used to create a mapping between the RFK cookie and a real user ID.

n/a

value.context.page

Object

Required if site is set up with locale configuration.

Add page-specific information (including locale information) under a page object. Refer to Page Object.

n/a

value.user (deprecated)

Object

Optional.

User information object that has a permanent user ID such as fbid, cmid, rpid, user email, or eid, and so on.

n/a

value.locale (deprecated)

Object

Optional.

A locale object. This attribute is deprecated. We suggest you use the page object for locale data.

n/a

Sample event specification

The following is an example of an order event object. This example is in the new format, which means it contains a context object.

RequestResponse
{ 
  "type": "order", 
  "name": "confirm", 
  "value": { 
    "context": { 
      "user": { 
        "id": "user-1234", 
        "email": "[email protected]", 
        "eid": "<hash_of_email>", 
        "fbid": "<facebook_id>", 
        "address": { 
          "address_line_1": "123 Main Street", 
          "address_line_2": "apartment 123", 
          "state": "CA", 
          "zip": "90210", 
          "country": "US" 
        } 
      }, 
      "page": { 
        "<locale_country": "country code, 2 letters, lowercase, e.g. fr>", 
        "<locale_language": "language code 2 letters, lowercase, e.g. en>", 
        "<locale_currency": "currency code, 3 letters, lowercase, e.g. eur>" 
      } 
    }, 
    "products": [ 
      { 
        "sku": "191258", 
        "quantity": 1, 
        "price": 11.99, 
        "price_original": 19.99, 
        "fitment": { 
          "ids": [ 
            "2222" 
          ] 
        } 
      }, 
      { 
        "sku": "23432", 
        "quantity": 1, 
        "price": 12.99, 
        "price_original": 14.99, 
        "fitment": { 
          "ids": [ 
            "3333" 
          ] 
        } 
      } 
    ], 
    "checkout": { 
      "order_id": "1234", 
      "subtotal": 39.97, 
      "total": 50.96 
    } 
  } 
}

Do you have some feedback for us?

If you have suggestions for improving this article,