Multiple enrollments and anonymous contacts in Commerce marketing automation campaigns
Commerce marketing automation campaigns provide you with the ability to follow up when a customer places an order or abandons a cart. In either case, the customer may remain anonymous or may have placed multiple orders.
The pipeline processor
UpdateVisitorInAutomationPlan is used to manage multiple enrollments and anonymous contacts for cart CRUD operation pipelines including:
The processor accepts the parameters detailed in the following table.
Accepts a boolean value indicating whether the customer can be enrolled multiple times in the specified campaign or not (that is, the customer can be present in the campaign multiple times concurrently. The default value is false.
The standard MA conditions and options for enrolling contacts into a campaign only accepts the contact to be in a campaign once. In order to allow multiple enrollments, a unique key is required. In the case of the New Order Placed campaign, the key identifying the unique instance of the customer in the campaign is the order ID.
Accepts a boolean value indicating whether anonymous customers can be enrolled in the specified campaign or not. The default value is true. The standard MA conditions and options for enrolling contacts into a campaign, only accepts known customers, that is, customers who have registered, but because customers are enrolled by code, anonymous customers can be enrolled as well.
Name of the campaign being targeted.
The following code in the
UpdateVisitor processor includes the
Order processor UpdateVIsitor
<processor type="Sitecore.Commerce.MarketingAutomation.Pipelines.Carts.Common.UpdateVisitorInAutomationPlan, Sitecore.Commerce.Connect.MarketingAutomation" patch:source="Sitecore.Commerce.MarketingAutomation.Orders.config">
<basePlanName>New Order Placed</basePlanName>
For more information about the processor, see Order pipelines.
To handle customers who place multiple orders within the same session, customers must be allowed to be in a campaign multiple times concurrently especially when sending out order confirmations. This means the customer can place multiple orders within the same interaction or across multiple interactions before exiting the campaign after the first enrollment. By default, the customer is only accepted once and receives an order confirmation only for the first order placed.
By default, the New Order Placed campaign template supports multiple enrollments for the same customer, which is the case when the customer places more than one order while enrolled in the same marketing automation plan. You can find the configuration settings to support multiple enrollments on the plan template (/sitecore/System/Marketing Automation Template) in the Plan Data field. By default, the ReentryMode is set to 2 (multiple enrollments) and the ContextKeyFactoryType is implemented in
This implementation uses the order id as a key for enrollment. Reentry mode 1 (Single) indicates that a customer can only go through the plan once.
If a customer does not register and remains anonymous, the contact information is captured when the customer enters an email address, for example, on the Billing page. With the Storefront site template, the billing page includes the customer contact information as shown in the following figure.
In cases where the email address of the customer placing the order is different from the email address defined on the Billings page (such as for a company order) or for an anonymous customer, it is necessary to capture the email address in order to send the order confirmation, abandoned cart email reminder, or the recommended products email message. This email address is stored on the shopping cart. It is automatically set as the preferred email address on the contact in xDB. Support for anonymous customers is provided by the SetAnonymousPreferredEmail processor in the