The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Developer Considerations for Explicit Recommendations

Product recommendations are considered best practice, but you can also use explicit recommendations if necessary.

Some Salesforce B2C Commerce storefront applications were developed using the product linking feature. This feature pre-dated the explicit recommendations feature in Business Manager and requires added considerations.

You can define product-to-product relationships to provide for replacement products, cross-sells, up-sells accessories, follow-up, a different order unit or spare parts. With the product linking feature, you define simple links between products. For example, linking older versions of a product with newer versions.

If you use the product links feature, you do not need to convert to the recommendations feature. B2C Commerce also supports product linking. However, enhancements are made only to the recommendations feature.

With a product linking and explicit recommendation implementation, you can:

  • Create added recommendation types through custom attribute definitions.
  • Define the presentation logic for the additional recommendations within UX Studio in your storefront cartridge.

When using both features, keep the following in mind:

  • Product links conceptually are intended for fundamental relationships between products. For example, product-to-part relationships.
  • Recommendations can appear only on a site if the storefront catalog contains the recommendation. Product links are not directly stored in a catalog and don't have this restriction.
  • Recommendations are system objects and can have custom attributes. Product links can't have custom attributes.

Some reasons for moving away from a product linking implementation and switching to or adding recommendations include:

  • Implementing category to product recommendations.
  • Using recommendation-specific attributes (for example, name, short description, long description, callout message, or image). These attributes let you customize the presentation of a specific product based on the target object and recommendation type.

When working with Explicit Recommendations, use these developer best practices.

When working with your merchandising team:

  • Make sure to provide the team with a clear understanding of how explicit recommendations are implemented within their storefront. It helps merchandisers to understand various use cases including:
    • Not defining any recommendations.
    • Defining more than the specified number of recommendations.
    • When imports are scheduled (if using the recommendation import functionality). This information is important for building imports into business process time and allowing for validation and augmentation as necessary.
  • When using variation products, make sure to understand whether to assign recommendations to the base product, variation products, or both. How you assign these products affects how these products appear in the storefront.

As shown in the SiteGenesis application, it is important to note that the default behavior is to show recommended products regardless of availability. Because of this default behavior, we suggest that you change your application to show recommended products only if they are in stock.

When determining how to implement explicit recommendations, consider these planning and development phase guidelines.

These guidelines include considerations for the following phases:

  • Requirements phase
  • Design phase
  • Build phase
  • Development and test phase

During the requirements phase, you idenfify how many types of recommendations are required for the solution. For each identified recommendation type, first determine requirements for the following:

  • Presentation logic: Where each recommendation type renders, how many recommendations are presented at a time. This determination includes what occurs when:
    • No recommendations are defined for a given category or product.
    • Fewer than the planned number of recommendations are defined for a given category or product.
    • More than the planned number of recommendations are defined for a given category or product.
  • Visualization requirements: How individual recommendations appear and what data elements are required to support any specific visualization.

After making these determinations, identify how you want recommendations populated (import, manual, programmatic, or other). You can populate recommendations during development or when the site is live.

If you plan to manually create recommendations in Business Manager, make sure to identify the following:

  • Who creates and maintains the recommendation.
  • Any necessary review process.
  • How to test the recommendation.
  • How recommendation data is replicated with catalog data.

If you plan to import recommendations, define the import process. If possible, implement this process as a job within Salesforce B2C Commerce so that you can take advantage of the scheduling and notification functionality built into the system.

After you solidify information in the requirements phase, you can move on to the design phase. During this phase, consider the operational overhead and merchant ease of use.

ConsiderationDescription
Operational overheadReview the day-to-day operational overhead associated with creating and maintaining recommendations manually within the system―especially if you have large product catalogs. Determine whether you require that all products appear with explicit recommendations; if you do, consider whether it would be advantageous to add simple logic into the presentation rules. If you plan to build logic into B2C Commerce to dynamically determine which products to recommend, pay attention to any additional page rendering overhead. Additional overhead can negatively impact storefront performance. Make sure to consider what you can populate as part of the import process using logic based on existing attributes and category assignments.
Merchant ease of useEnsure that you know the product or category ID. This information enables you to more accurately search within the Business Manager Recommendations module. For ease of use, ensure that these values are meaningful to your organization.

Following the design phase, you enter the build phase where you build code to support recommendation requirements. You then facilitate the development and test phase:

  • Create users with permissions that are in line with your business processes.
  • Create an initial set of test recommendations.
  • Use a test plan to ensure that all use cases are reviewed.
  • Test the import process, if applicable.

Explicit recommendations use an extensible system object to include native attributes.

This table lists the native attributes included with the Recommendation system object.

IDTypeDescriptionLocalizable
UUIDStringThe recommendation's internal identifier.No
calloutMsgHtmlThe recommendation's callout message.Yes
creationDateDate + TimeThe recommendation's creation date. This does not change.No
imageImageThe image associated with the recommendation that appears on the storefront.No
lastModifiedDate + TimeThe date and time at which the recommendation was modified. This changes with each edit.No
longDescriptionHtmlA detailed description of the recommendation.Yes
nameStringThe name of the recommendation as it will appear on the storefront.Yes
RecommendationType (see below)Enum of IntegerThe recommendation type in integer format.No
ShortDescriptionHtmlAn abbreviated description of the recommendation.Yes

The number of recommendation types is extensible and the labels associated with the types in the Business Manager are configurable. RecommendationType is configured with three default values:

  • 1 (cross-sell)
  • 2 (up-sell)
  • 3 (other)

If these types don't satisfy your requirements, you can add new types or rename existing types.

To add additional attribute values, you can:

  • Configure them manually in Business Manager: Administration > Site Development > System Object Type > Recommendation.
  • Create them as part of a meta data import feed.

Salesforce B2C Commerce reports on recommendations using pipeline processing reports and system logs.

B2C Commerce provides pipeline processing data in Reports & Dashboards. To view the pipeline reports, select Merchant Tools > site > Analytics > Reports & Dashboards. Select the Technical Dashboard tab.

Because many implementations use pipelines to process recommendations, the Pipeline Usage and Pipeline Errors reports can provide useful information when testing and troubleshooting recommendations. You can also use the Pipeline Debugger.

System logs capture information related to API processing, data staging, and error handling. These logs can provide useful information when troubleshooting recommendation-related issues. To access system logs, select Administration > Site Development > Development Setup > WebDAV Log File section.

Developer work to define product recommendations includes modifying ISML templates, defining content slots, providing a unique ID, along with other customizations.

When implementing product recommendations, keep the following in mind:

  • Modify ISML templates to define content slots and display product recommendations.
  • When defining content slots for product recommendations, make sure you give the slot a unique ID and set the context to global.
  • If the content slot renders recommendations on product detail or category-landing pages, include the referring product ID or category ID as part of the context-object attribute.
  • You can pass the context-object attribute a basket or dw.util.Collectionof products. This option enables you to create and use recommendations based on selected products (up to 5), or all products in the basket.

This example <islot> tag shows how to define a slot for use on a product detail page:

This example shows how to define a slot for use on a category landing page:

For defined content slots on your storefront, make sure to create a page template to render the recommended products. If you already have a template that renders other types of product content slots, you can reuse these templates with some modification. When reusing a template, copy it to the /templates/default/slots/recommendation/ folder.

The following example provides a product template for showing product recommendations:

When developing slot-rendering templates for product recommendations, make sure that slot content caching is performed properly. Due to the dynamic nature of product recommendations, make sure not to cache the entire slot. If you cache the entire slot, every visitor experiences the same recommendations. Instead of caching the entire template, ensure that caching occurs when rendering individual product tiles.