Skip to Content

SAP Hybris Marketing Cloud offers OData service that allow the integration of SAP Hybris Marketing Recommendations into client applications across all sales channel.

It is possible to simplify the integration of the Product Recommendations into any web page by embedding a code snippet with a reference to a JavaScript library hosted on SAP Cloud Platform. It performs a REST Call which will in turn perform the OData call to SAP S/4HANA Marketing Cloud to obtain real time context-aware product recommendations.

This way, all the client application need to do is to integrate a small code snippet and provide the different context parameters. Custom styling can be performed to allow a seamless UI integration.

For more information about the OData service, see the SAP Hybris Marketing Extensibility Guide.

Please note that the source code is provided as a code sample which can be used as is or enhanced to fulfill expected behavior. The instructions and source code is available in the following link.


In order to deploy the application, you need the following:

  • SAP Hybris Marketing Cloud  / SAP Hybris Marketing 1702 or newer
  • SAP Cloud Platform account

Code Snippet Installation

  1. Download
  2. Extract in a folder (ex: /reco)
  3. Import /reco as a project in Eclipse
  4. Configure the application by editing the property (see section below)
  5. Maintain public/css/reco-custom-arrows.css with a link to your arrow images
  6. To upload products at startup, include an import.sql script file under src/main/resources. (see section below)
  7. Right click project in Eclipse and Configure à Convert to Maven project
  8. Test the application locally by running mvn spring-boot:run, or create the deployable war file by running mvn clean package
  9. To deploy to SAP Cloud Platform, upload the /target/reco.war file as a Java application in the SAP Cloud Platform Cockpit and start the application.

Configuring the Application

Before deploying the WAR file to the SAP Cloud Platform, the following configuration needs to be done

This file contains the recommendations specific configuration parameters including:

  • Connection: URL and credentials to the SAP Hybris Marketing Cloud  / SAP Hybris Marketing server
  • Product Settings: Item type used to upload Product to SAP Hybris Marketing Cloud  / SAP Hybris Marketing server (cuan product facet)
  • User Settings: Origin of Contact ID used to contact SAP Hybris Marketing Cloud  / SAP Hybris Marketing server (user origin facet)
  • Interactions: Interaction Type and enablement of external tracking (post impressions explicitly)
  • Impressions: Impression posting settings
  Recommendation: The connection setting have to be done at a minimum.


To upload products at start up, you can at the product data in this sql script in the following format:

insert into PRODUCT(id, name, description, price, targetUrl, imageUrl, 
thumbUrl) values ('prod_id','prod_short_desc','prod_long_desc',price,
'https://prod_thumbnail_image_url ');

Consuming the Application

To provide recommendation on a Commerce home page, the following code snippet can be embedded into a web page.

<script src="https://[YOUR_SERVER_NAME]/reco/snippets/recoAll.js"></script>
<div id="carouselReco1"
  data-userId="" data-cookieId
  <h1 class="headerTitle">Top Sellers</h1>

Here are the descriptions of the different parameters:

  • data-scenarioId: The name of the recommendation scenario to be consumed from Hybris Marketing
  • data-carouselId: The Id of the div where recommendation will be inserted
  • data-userId: The User Id of the logged on user (Optional – if known)
  • data-cookieId: The cookie ID of the user (Optional)
  • data-leadingItems: The leading products (comma separated) (Optional)
  • data-basketItems: The product sin the basket (comma separated) (Optional)
  • data-context: The additioonal context (Optional)
  • data-useProductURL: Use the current window.location.href as the leading item
  • data-server: The URL to your SCP server

To provide recommendation on a Commerce product detail page, the following code snippet can be embedded.

<script src="https://[YOUR_SERVER_NAME]/reco/snippets/recoAll.js"></script>
<div id="carouselReco1" 
  data-leadingItems="[ID of your leading object]"
  <h1 class="headerTitle">Cross-Sell</h1>
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply