Best practices for web and dialog activities

Review these best practices for creating web and dialog activities so that you can learn ways to manage activities more easily and reduce storefront performance impacts.

1. Place targets that are most likely to be met on the first path in the activity

Activities can contain multiple paths, each with a different target. For these types of activities, you can minimize the storefront performance impact by ordering the targets in the following sequence:
  • Place the target that is most likely to be met on the top path.
  • Place the target that is the second most likely to be met on the second path, and so on.

This approach can reduce the number of targets that must be checked each time that the activity runs.

Consider the following example web activity, which contains two paths that use the Customer Segment target to show a different ad to male versus female customers. If you know that your store has more male customers, put that target on the top path:

Figure 1. Web activity with targets on multiple paths

Web activity example

2. Limit the number of paths in a single activity

Activities with many paths can become difficult to manage in the activity builder. If you run into problems, consider splitting the paths across multiple activities.
For example, rather than creating a single activity with 100 paths, you can use this approach:
  • Create four separate activities.
  • Create 25 paths in each activity.
  • Assign each activity a different priority number, for example, 4, 3, 2, and 1.

On the storefront, the activity with priority 4 runs first, followed by 3, then 2, then 1. The four activities that are combined produce the same result as the single activity, without overburdening the activity builder.

3. Limit the nesting depth for branches

You can nest a branch element within another branch element, and then nest that branch element within another branch element, and so on. The more nesting you do, the greater the impact to storefront performance. The maximum number of nested branch elements is four.

4. Consider the storefront performance costs when you choose targets for web activities

Certain targets have a higher storefront performance cost than others. To improve site performance, consider limiting the number of high-cost targets that you use in web activities. For example:
  • The Customer Segment target has a relatively high performance cost. Each time a customer is evaluated against the target, the server must retrieve the customer's attributes from the database and match them to the customer segment attributes.
  • The Current Page target has a relatively low performance cost. Current Page target evaluations that are related to catalog browsing can be cached with the catalog page. Other Current Page target evaluations do not require any database queries.
    Tip: If you configure the Current Page target to target customers who are viewing a catalog entry that matches specific filters, the evaluation queries the HCL Commerce search index. To maintain a low performance cost when you use this option for the target, IT or a site administrator can cache the search query results for the web activity. Cache the web activity search results as part of the product details page.