Pages

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:

  1. Create and configure the recommendation.
  2. Test that the recommendation returns the correct data.

Creating and configuring the recommendation

To create and configure the recommendation:

  1. In the Frosmo Control Panel, select Data Management > Recommendations > Configurations.
  2. Click Create recommendation.
  3. In the code editor, replace the default recommendation configuration with the following one.

    {
        "name": "Products purchased together",
        "description": "Top 5 products purchased together in the past 24 hours",
        "type": "bundle_converted",
        "frequency": "15m",
        "hours": 24,
        "limit": 5,
        "map_ids": "product",
        "params": [
            "productId"
        ],
        "options": {}
    }

    The important settings here are the following:

    • typebundle_converted is the recommendation type for products purchased together.
    • frequency15m means that the recommendation is regenerated every 15 minutes based on the latest data collected from the site.
    • hours24 means that the recommendation is always generated from the last 24 hours of data collected from the site (in this case, product and transaction data).
    • limit5 is 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.
    • map_idsproduct instructs 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_converted require a single request parameter: the ID of the product for which to recommended other products. Here, the parameter is named productId.

    For more information about the recommendation settings, see Creating recommendations.

  4. Click Save. The Frosmo Platform queues the recommendation for processing.
  5. 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.

Recommendation has been successfully generated

Figure: Recommendation has been successfully generated

For more information about the status, see Creating recommendations.

Testing the recommendation

To test the recommendation:

  1. In the Control Panel, select Data Management > Recommendations > Configurations.
  2. Click the quick menu button for the recommendation, and select Preview.

    Testing the recommendation

  3. Define a product ID in the request URL, since the returned data is product-specific.

    Testing the recommendation

    Testing the recommendation

    If the product has been purchased together with other products by one or more visitors within the time frame defined by the hours parameter, 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>/products endpoint of the Graniitti API, and check the product_id values in the response data.

    curl -X GET \
    --header 'Authorization: Bearer <access_token>' \
    'https://<graniitti_api_domain>/v0/sites/<site_id>/products'

    For more information about making Graniitti API requests, see Authentication and Requests in the Graniitti API guide.

  • No labels