This scenario checks to see if the total cost of an order placed is 25% greater than the average of her previous orders. If it is, the user receives a promotion for 10% of her next order. This scenario relies on values of the Number of Orders and Person’s Average order price, which are recorded by the ComputeAvgOrderTotal scenario into the buyer’s profile. See the description of that scenario below for details.

The first step in this scenario checks when an order is completed. When an order is completed, its sub-type changes to “Order is finished”. We check for this rather than for when the order is submitted to avoid giving promotions for orders that are later cancelled. The next step checks whether this buyer has placed five orders to be sure that she has an established average order total.

Next, we check if the order is 25% greater than the buyer’s average order total. This is a custom condition written for Motorprise called Order Comparison. It allows you to enter the percentage difference you are looking for. If the order is 25% greater than the average order total, then the buyer receives a promotion for 10% off their next order. He or she also receives an e-mail about the promotion. Because Motorprise has both English and German speaking customers we send the e-mail in the appropriate language by checking their locales before choosing the appropriate e-mail template.

We added a property to the user profile in Motorprise that indicates the number of orders placed, numOfOrders, and a property that tracks the average total of all the user’s orders,avgOrderAmt. Whenever she submits a new order, these two properties are updated with the appropriate values.

We created a new scenario action, Compute Average Order Total, to calculate average order total of user is created. This action takes order total as input and calculates the average order total from avgOrderAmt and numOfOrders.

Based on this action, a scenario is created with OrderSumitted as the event and the amount of the order as input to the action. Also numOfOrders is increased by one whenever an order is created. Whenever an order is submitted, this action is invoked with the order amount as input; it then calculates the new average of order total s and stores that value in avgOrgAmt.

For more information on creating scenario actions, refer to ATG Personalization Programming Guide.

 
loading table of contents...