Skip to main content

Example: Recommending the most popular items based on visitor affinity

This example shows you how to create a recommendation for the most popular items in the past 7 days based on visitor affinity. The recommendation comes in two competing variations that each use a different level of affinity for sorting the recommendation results. This allows you to test which level of affinity performs better over time. The example assumes that the site already has the necessary recommendation template and placement set up and ready to use, so you'll only be creating the strategies and modification for the recommendation.

In this example, you:

  • Create two recommendation strategies for the top 10 most popular items on the site based on visitor affinity. The most popular items comprise (a) the top 5 most viewed items on the site in the past 24 hours and (b) the top 5 most purchased items on the site in the past 7 days. The two strategies differ only in that one uses 50% affinity, while the other uses 100% affinity. The strategies do not use fixed items or filters.

  • Create a modification for displaying the recommendation on the site home page. The modification is a multi-armed bandit modification with 2 variations, one for each strategy. The variations use a recommendation slider template that includes a strategy selector.

You create the recommendation strategies and modification in the Frosmo Control Panel.

The following figure shows an example of the final recommendation on the home page. The set of recommended items is different for each visitor based on their specific affinities.

Home page with a recommendation for the most popular items for the current visitor
Figure: Home page with a recommendation for the most popular items for the current visitor

For generating the recommendation, this example relies on product data and transaction data collected from the site. The example therefore assumes that product and transaction tracking are correctly set up on the site.

If you're trying out this example on a production site, but do not want the example to interfere with production content, use either test mode or a workspace in creating the example. You can also safely preview the modification from the Control Panel.

To create the recommendation:

  1. Create the recommendation strategies.

  2. Create the modification for displaying the recommendation.

Creating the recommendation strategies

Both recommendation strategies return up to 5 items most often viewed on the site in the past 24 hours and up to 5 items most often purchased on the site in the past 7 days. The strategies sort the items based on visitor affinity. The strategies do not define fixed items or filters.

To create the first recommendation strategy:

  1. In the Frosmo Control Panel, in the sidebar, select More > Recommendations.

  2. Click Create recommendation strategy.

  3. Define the following settings:

    • Name: Enter "Most popular on site with half affinity". Note that the ID automatically completes to "most-popular-on-site-with-half-affinity".

    • Page type: Select Home.

    • Algorithms: Select the following algorithms (in order):

      • Most viewed on the site in the past 24 hours, 5 items

      • Most bought on the site in recent days, 5 items

    • Sorting: Select Affinity, and set the slider to half-way (50%). This means that a visitor's affinity for an item counts for 50% of the item's final recommendation ranking. The algorithm determines the other 50%.

    The following figure shows the complete recommendation strategy in the Control Panel. Click the figure to view a larger version.

    Complete recommendation strategy in the Control Panel

    For more information about the settings, see Creating and editing a recommendation strategy.

  4. Click Save. The Frosmo Platform generates the recommendation data for the new strategy. The data generation may take several minutes.

  5. Optionally, in the Preview section, review the items returned by the strategy. By default, the preview shows the recommendation results without any affinity applied. To show the results with affinity applied, enter a Visitor ID.

To create the second recommendation strategy, repeat the above steps, but:

  • Enter "Most popular on site with full affinity" as the name.

  • Set the affinity slider to full affinity applied (100%). This means that a visitor's affinity for an item counts for 100% of the item's final recommendation ranking. The strategy ignores how the algorithm ranks the item.

You have created the recommendation strategies. You can now use their recommendation data in a modification.

Creating the recommendation modification

For example purposes, let's assume you have the following predefined in the Control Panel:

  • Placement for a home page recommendation

  • Template for a recommendation slider with two content options: title and recommendation strategy selector

To create and activate the recommendation modification:

  1. In the Control Panel, in the sidebar, select Modifications.

  2. Click Create modification.

  3. Enter "Home page - Recommendation - Most popular for visitor" as the modification name, select Multi-armed bandit as the modification case, select Recommendation as the content type of the modification, and click Create.

    Creating the recommendation modification

    For more information about the settings, see Creating and editing a modification.

  4. Select the placement for the modification:

    1. In the Basic settings view, in the Placement section, click Select placement.

      Selecting the placement for the recommendation modification
    2. Select the predefined placement for a home page recommendation. In this example, the placement is Home page - Recommendation 1.

      Selecting the placement for the recommendation modification
    3. Click Save.

    For more information about the settings, see Defining the placement for a modification.

  5. Define the content for the modification:

    1. In the Basic settings view, in the Content section, click Create variation.

      Defining the content for the recommendation modification
    2. In the variation settings, for Content source, select Template.

    3. In the templates list, select the predefined template for a recommendation slider. In this example, the template is Recommendation slider.

      Defining the content for the recommendation modification
    4. In the Content options section, enter an appropriate title for the recommendation, such as "Most popular for you", and select [Home] Most popular on site with half affinity as the recommendation strategy.

      Defining the content for the recommendation modification
    5. At the bottom of the view, click Save.

    6. Back in the Content section, click the quick menu button for the variation, and select Activate.

      Defining the content for the recommendation modification
    7. Repeat the above steps to create the second variation, but select [Home] Most popular on site with full affinity as the recommendation strategy.

    8. Back in the Content section, click Define distribution.

      Defining the content for the recommendation modification
    9. Select Click as the reward, select Epsilon-greedy or Softmax as the algorithm, and click Save. Both algorithms will always leave some distribution for the losing variation, meaning the variation will always be displayed to some portion of visitors. This allows the losing variation and the winning variation to swap places if the former starts outperforming the latter.

      Defining the content for the recommendation modification
    10. Back in the Content section, if you want to disable the comparison group for the modification, click the quick menu button for the group, and select Deactivate.

    For more information about the settings, see Defining the content for a modification.

  6. Activate the modification:

    1. At the bottom of the Basic settings view, click Activate.

    2. To confirm, click Activate.

You have created and activated the modification. The recommendation is now live, and you're done with this example!