Predictive Basket (subject to change)
Display personalized predictions with the experimental Predictive Basket component.
Documentation
Predictive Basket
The ff-predictive-basket element allows for easy integration with the FactFinder Predictive Basket feature. To use it, you need a version of FactFinder NG and WebComponents 3.15.5 or higher.
Due to being subject to change, the Predictive Basket feature is not available by default in WebComponents. It must be activated by configuring two values on page load as follows:
document.addEventListener("ffReady", ({ factfinder }) => {
factfinder.communication.globalSearchParameter.version = "ng";
factfinder.__experimental.predictiveBasket.enable = true;
});If this is not configured, the ff-predictive-basket element will throw errors on attempting to use it.
The Predictive Basket element
The following listing shows the newly introduced element. The element itself does not have a visual component and must be used in combination with an ff-record-list in the same manner as ff-recommendation. See further below for more details.
<ff-predictive-basket user-id="123456"
max-results="10"
blacklist="art-id1,art-id2">
<!-- requires ff-record-list here to work -->
</ff-predictive-basket>Once the element is correctly initialized, it will automatically issue a request to FactFinder and display the result through the nested ff-record-list. This will happen only once per page load. If you need to refresh the displayed data, refer to the getPredictions() method below.
Attributes
user-id
The ID of the user for whom products shall be predicted. Setting this attribute will cause the element to issue a request once it is initialized. Additionally, changing userId will also automatically issue a new request.
If the user ID is not specified, no request to FactFinder will be issued. Instead, an error will be logged to the browser's console.
max-results
The maximum amount of products to be returned from FactFinder. To receive all predictions, omit this attribute or set its value to -1.
* Default value is inherited from the FactFinder API.
blacklist
With the blacklist attribute, you can specify one or more product IDs that shall not be returned from FactFinder. This may be useful if you, for example, don't want products to appear in the predictions once the user has placed them in their shopping cart.
Methods
predictiveBasketElement.getPredictions()
This method issues a request to FactFinder with the currently set values.
Example setup
Manual update with blacklist
Last updated
Was this helpful?