How to Build Your Own Product Recommendation Engine

A common application of is in powering custom recommendation engines. For many companies, generic solutions don’t offer enough flexibility (or require too much work manually setting up links between all of the different products in the catalog), and building a custom recommendation engine from scratch requires way too much time and effort.

To show how easily it can be done, we’ve put together an open source Product Recommendation plugin for Drupal Commerce stores that lets anyone spin up their own product recommendation engine with

You can see this recommendation engine in action on our demo store:


How Do The Recommendations Work?

When a user is looking at a product page on an online store, the goal of this recommendation agent is to identify the other products in the catalog that might be relevant.

The way differs from other machine learning platforms is that we let developers encode their own knowledge about how a system should work as a set of rules. The API uses those rules to provide recommendations. Over time, as feedback is sent to on how well the rules performed, the API learns and improves automatically.

In our sample recommendation agent, we identified a few rules that might show affinity between the current product and each of the other products in the catalog:

  • If the current product and another product are in the same category, it’s likely to be a good recommendation
  • If the current product and another product are not in the same category, it’s less likely to be a good recommendation
  • If the current product and another product have very different prices, it’s less likely to be a good recommendation (i.e. it decreases affinity)
  • If many customers who bought the current product also bought another product, that’s likely to be a very good recommendation (i.e. it increases affinity)
  • If the current product and another product have many of the same words in their titles, it’s likely to be a good recommendation (i.e. it increases affinity)
  • If the current product and another product have many of the same works in their descriptions, it’s likely to be a good recommendation (i.e. it increases affinity)

Here’s what those rules look like when created within


Keep in mind that these were purposely chosen because they can work generically for many online stores. Specific stores may have other rules that make sense, for example, a clothing store may want to show products for the same season and so might add rules like:

  • If sameSeason is true then affinity is high
  • If sameSeason is false then affinity is very low

What’s Next?

If you want to try it for yourself, sign up for a account and follow the instructions in the Drupal Commerce Recommendation Engine plugin on GitHub.

This project is meant as a starting point. Every developer will likely have their own modifications to make to the rules and integration in their ecommerce platform.

In an upcoming blog post, we’ll talk about how to add feedback into this recommendation engine so that it can learn based on actual customer behavior over time.

Build Your Own AI-Powered Twitter Feed

One of our favorite quick demos of’s capabilities is to show how easy it is to take your own Twitter feed, score each of the Tweets, and surface the most relevant ones. It’s one of the first new agent templates we built for the platform and it’s a lot of fun to try out.

To show how easy it can be, we put together a Ruby on Rails project to help you get started and get more acquainted with You can find that project on GitHub.

Getting Started

Getting your Tweet Relevance agent set up will take just a couple of minutes. Once you’ve signed up for a free account, go to your Dashboard and take note of the API key shown on the top left-hand corner of the page. You’ll need it later.

Next step is to create your Tweet Relevance agent. There are two ways to do this. The easiest way is to use this link and just click on Create.

Alternatively, you can create it manually by logging into your dashboard, clicking on the ADD AN AGENT  button. From there, select the TWEET RELEVANCE template:


That will automatically create a Tweet Relevance agent like the one below:


This initial template starts off with just 3 rules that should be pretty easy to understand:

  • tweets with more likes are more relevant
  • tweets with more shares are more relevant
  • older tweets are less relevant

Take note of your agent ID, which is found just above the TWEET RELEVANCE title on this page. Later in this post we suggest a few things you can add to this, but this is a good starting point.

Installing the Rails App

Next step is to clone our Tweet Relevance Ruby on Rails on GitHub, and follow the installation instructions in the file, from there you’ll be guided through the next steps of setting up the app.


Once you’ve got things set up, your app will show you the tweets that are most relevant based on the rules we defined earlier. Each tweet will be scored like this: TweetRelevance.png

What’s Next?

Now that you’ve got this simple app working, what else can you do? If you want to play around with the app and, here are some other things you could try:

  • Add new rules that take into account your friends’ behavior: how many people you follow liked a tweet, how many people you follow shared a tweet.
  • Try combining different rules, for example if you want to identify tweets that are liked by your friends but not a lot of other people, that rule could be: IF number of likes by friends IS very high AND number of likes IS low THEN relevance IS very high.
  • Set up rules to increase relevance of tweets that include keywords you’re interested in and decrease relevance of tweets that include keywords you’re not interested in.
  • Add a feedback metric to train and improve the results: add thumbs up and thumbs down buttons next to each tweet that send positive or negative feedback to the API based on which tweets you find most or least relevant.


What To Expect After Launching on Product Hunt

Last week, we launched Personal Hunt to the Product Hunt community. It was a fun project to build as a demo of our (still in beta) product, It was also the first time that Evan and I (Matt) had launched a product on Product Hunt, so we wanted to share the results.

The Project

As we were building out the first version of, we were looking for an interesting way to demonstrate how it can be used to quickly build out a recommendation engine. Instead of building an app that’s good for demos and nothing else, why not build something useful?  If you’re curious about the development process, we wrote more about the process of building out the core of Personal Hunt last week. Now that we’ve got some data from hundreds of new users, we can do some better statistical modelling and give even better recommendations.


Personal Hunt had only a handful of test users before launching, so it is an interesting illustration of the effect of a Product Hunt launch. Here are our launch day results:

  • 253 upvotes on Product Hunt
  • 3,328 sessions across 2,689 uniques to
  • 590 users logged into Personal Hunt with their Product Hunt account

Here’s an hourly look at traffic to Personal Hunt:

Hourly Overview


It’s interesting to see the different levels of traffic throughout the day. We were ranked #2 or #3 until roughly noon EDT, and spent the rest of the day in the top 10. This might be a nice illustration of how referral traffic dips once you go below #3.

And here’s a look at Personal Hunt’s analytics over the last few days, as traffic has stabilized at 150-200 daily sessions:

Personal Hunt Analytics


Launching a new product is really hard. Regardless of whether you worked on it for 2 days or 2 years, exposing your work to the world makes you vulnerable, and is a really stressful thing to do.

What if it breaks?

What if it’s not useful?

What if people think it’s stupid?

What if people think I’M stupid?

What’s great about Product Hunt is the empathy, respect and support that the community provides to fellow makers.

Left alone, online communities tend to degrade into snark and negativity. Ryan, the Product Hunt team, and the entire community deserve a huge amount of credit for having built and maintained this positivity in the face of huge growth.

A great example is when some users were having trouble logging in to Personal Hunt, Josh Barkin of (the awesome) NewsGIF suggested that the Product Hunt Chrome extension might be the cause. He even updated his own site’s code to suggest a fix. That kind of camaraderie and willingness to help is amazing!

Wrapping Up

Hopefully some of the data points above will help other makers to plan for their own Product Hunt launches. It was a great experience all around.

You can check out Personal Hunt here.

If you’re a developer or product manager interested in learning more about how can help you build your own recommendation engine, drop us a line.