Once you've implemented product and transaction tracking for your site, you're ready to create the recommendation. The recommendation returns five other products most often purchased with a given product within the past 24 hours.
To create the recommendation:
Creating and configuring the recommendation
To create and configure the recommendation:
- In the Frosmo Control Panel, select Data Management > Recommendations > Configurations.
- Click Create recommendation.
In the code editor, replace the default recommendation configuration with the following one.
The important settings here are the following:
bundle_convertedis the recommendation type for products purchased together.
15mmeans that the recommendation is regenerated every 15 minutes based on the latest data collected from the site.
24means that the recommendation is always generated from the last 24 hours of data collected from the site (in this case, product and transaction data).
5is the maximum number of products to include in the recommendation. This is the number of other products to recommend for a given product. If customers have purchased more than six products together, the recommendation returns the five most purchased products.
productinstructs the Frosmo Platform to return the full product data for each recommended product. The alternative is to return the raw recommendation data for each product, but then you'd have to separately retrieve the product data to display in the modification.
params: Recommendations whose type is
bundle_convertedrequire a single request parameter: the ID of the product for which to recommended other products. Here, the parameter is named
For more information about the recommendation settings, see Creating recommendations.
- Click Save. The Frosmo Platform queues the recommendation for processing.
- To return to the list of recommendations, click Cancel.
Once the recommendation status changes to Success, the recommendation has been successfully generated, and you can retrieve the recommendation data.
Figure: Recommendation has been successfully generated
For more information about the status, see Creating recommendations.
Testing the recommendation
To test the recommendation:
- In the Control Panel, select Data Management > Recommendations > Configurations.
Click the quick menu button for the recommendation, and select Preview.
Define a product ID in the request URL, since the returned data is product-specific.
If the product has been purchased together with other products by one or more visitors within the time frame defined by the
hoursparameter, that is, 24 hours, the page displays the corresponding recommendation data in the JSON format. If the product has not been purchased together with other products, or if the product ID is invalid, the page displays an error.
If you need to find out what products IDs are available on your site, send a GET request to the
/sites/<site_id>/productsendpoint of the Graniitti API, and check the
product_idvalues in the response data.