Order Statistics Enricher

Overview

The Order Statistics enricher for SAP Hybris Profile is a lambda enricher that gathers metrics for customer orders throughout the lifetime of the customer with the tenant.

The enricher gathers the following metrics and adds the statistical information to the profile as insights.metrics.orders:

  • allOrdersValuesSum - The sum of the values of all purchased items. The sum does not include the discounts or shipping costs added to the order.
  • allOrdersCount - The total number of orders recorded for this customer; returns do not alter this number.
  • avgOrderValue - The average order value of the customer.
  • avgOrderValueAllCustomers - The average order value of all customers of a given tenant.
  • discountRatio - The ratio of totalDiscountValue and allOrdersValuesSum, this value changes only if the order receives a discount.
  • discountFrequency - The ratio between discountedOrders and allOrdersCount, this value changes only if the order receives a discount.
  • totalDiscountValue - The total value of discounts which the customer has received with the tenant, this value changes only if the order receives a discount. This value includes the shipping costs added to the order.
  • discountedOrders - The total number of orders in which the customer has received a discount, this value changes only if the order receives a discount.
  • lastOrderId - The id of the last order placed by this customer.

The enricher gathers the following metric and adds it to the transactions.orders.{orderId} section of this customer's profile:

  • lastOrder - A boolean field that denotes whether this particular order is the most recent order placed by this customer.

This enricher reacts to the context/commerce/OrderCreated schema.


Events

The following events in the Context service trigger the Order Statistics enricher:

EventTriggering schemaSample payload of a context eventProfile document before eventEvent outcome in the profile document
OrderCreatedcontext/commerce/OrderCreatedSample payloadSample profile beforeSample profile after


  • Send feedback

    If you find any information that is unclear or incorrect, please let us know so that we can improve the Dev Portal content.

  • Get Help

    Use our private help channel. Receive updates over email and contact our specialists directly.

  • hybris Experts

    If you need more information about this topic, visit hybris Experts to post your own question and interact with our community and experts.