How to build a simple quiz-Based recommendation engine

chrislema-face

What is a recommendation engine?

If you've been online and browsed the web much, you've interacted with recommendation engines. They might not all feel like recommendation engines, but that's what they are. To make sure we're on the same page, let's start with my definition of a recommendation engine.

A recommendation engine is a system for information filtering—where your massive inventory of data (either products or content) is filtered down to a small subset specialized for each user based on activity, data, or pattern matching.

You've experienced it when you arrive on a blog, read an article or two, and get a list of posts at the bottom that you might want to read.

You've experienced it when you are looking at a product on amazon and it tells you that another product may be interesting to you as well.

As I said, you've interacted with recommendation engines even if you didn't know it.

Why are they awesome?

What makes them really awesome is the filtering aspect that is unique to you. These recommendation, when done right, are taking you into account. They're personalized. And every person who interacts with a well-designed recommendation engine feels “understood” in some way.

Another benefit is that good recommendation engines will help you find something you didn't even know existed.

When it's content, you go to a site and look at the most recent titles. Most of us don't go digging deep to find older gems that we should really read.

The same happens for products—when you don't even know that a particular product exists until Amazon (or another store) shows you that it does and that you might like it.

There are multiple kinds of recommendation engines

Some recommendation engines are tag-based. In these systems, like on a website, the system tracks the tags on the posts you've read, and then uses that model to determine which other posts (with their own tags) might match your reading preference.

Other systems are node and edge-based. These graph systems allow you to have nodes (people, products, content) and edges (“watched”, “read”, “liked”) and connect them. Once this graph database is created, it can be used to make recommendations either from the product space (other people who have purchased this have also purchased…) or the people space (here is someone you might want to follow on Twitter…).

Want to code your own? You can build your own using this tutorial or this oneThis one will help you do it in two minutes.

But what if you're not a developer and you still want a nice (albeit simple) recommendation engine? I'm going to show you how to do it using a simple, three-question quiz.

Get a Vacation Recommendation

[display_form id=5]

Building a recommendation engine (without coding)

Ok, so how did I build that simple quiz-based recommendation engine? I'll tell you.

My site is built on Rainmaker, so it comes with a version on Ninja Forms. The form you see above is a Ninja Form. And if you're using Ninja Forms on your own (non-Rainmaker) sites, you'll also need a Conditional Logic add-on.

First, create the form with the three questions and the two or three options for each one.

Step one is pretty easy. You create a form like any other. I use the List field type, and write out my question. Then I create the answer options.

I normally create radio-button questions. This way I know people will see the question, see the options, and I can control how long I want it to be.

createQuestions

Second, make sure you put calculation values for each question option.

What you see in the question image above is that I'm adding fields into the calc area. This is important because I'll be creating a way to sum all the answer options that have been selected and total them to determine which recommendation to give.

My particular trick here is that I use prime numbers (and not a sequential selection) for the calculation values. You might wonder what I'm doing. Let me see if I can explain it.

The trick to this kind of recommendation engine is that I need to know which answers they've selected. And I want the determination to be fast and easy. To that end, my approach is to use very specific values in each option so that the sum will always be unique.

In other words, no set of answers will ever give me a total that any other combination of answers will give me.

I know, in this example, exactly what a 43 means, and what a 97 means. I also know there are no two ways to get to 115 or 65.

The first three options are 1,3, 5. The second three options are 11,17, 29. The next two are 31 and 83. If that had been a threesome, they would have been 31, 59, and 83.

These are always the numbers I use. And I know the sums of these prime numbers, in any combination of answers from these questions will give me unique scores.

Third, create the calculation field.

When I talk about scores, I'm talking about the calculation field. In it, I simply add the three questions (their answer scores) together for a total. (In the form above, I haven't hidden that field, so you can see it.) That's the total that I'm going to use as the determination of my recommendation. Based on the score, I show you different recommendations.

Still no coding, but you do have to pick the three fields and put the “+” operator between them. 🙂

calculationfield

Fourth, I create conditionally-visible results based on the score.

The last step is the conditionally-based recommendation, which I put in a text field. You could have put it in a text area, or even redirected people to different pages based on the score. All of that is possible with this control.

For what I did, I added a new text field and then named it the same each time. In the Default Value, I picked “Custom Value” and filled in my recommendation.

Then I used the conditional display settings to make it appear based on the score.

conditionaldisplay

And I did that for the various scores that I already had on my list of scores.

See, the real work is knowing a specific recommendation for each combination of answers. In this case, it's 3 options times 3 options times 2 options. 3 * 3* 2 = 18 different recommendation.

Once you have them and put them in place, your recommendation engine is complete. And since it's a simple form, you can drop it into any page or post, as I've done here.

recommendations

Hopefully, that makes sense. You can use this approach for product recommendations. You can also use it for a diagnostic quiz – to help people know what they should do next. The truth is, you can use this in a variety of ways.

We can always talk directly if you have questions for your particular use.

About Chris Lema

Chris Lema has been working with WordPress since 2005. Over the years he's been a blogger, a speaker at WordCamps, a coach for WordPress product companies, and the founder of the conference for WordPress business owners, called CaboPress. Today he's the VP of Products at Liquid Web, where he manages the world's first managed platform for WooCommerce stores.

Chris Lema

Chris Lema has been working with WordPress since 2005. Over the years he's been a blogger, a speaker at WordCamps, a coach for WordPress product companies, and the founder of the conference for WordPress business owners, called CaboPress. Today he's the VP of Products at Liquid Web, where he manages the world's first managed platform for WooCommerce stores.

Join more than 7,500 others

My posts. Your inbox. Beautiful.

Chris Lema Speaking

Do You Want To Pick My Brain?

Over the last few years, through private consulting, coaching, and using the pay-by-the-minute Clarity service, I've helped hundreds of folks like you solve their WordPress problems and overcome their technical challenges.

“In 18 minutes Chris was able to save me months of lost time and tens of thousands of dollars by directing me to the right technologies to create my course marketplace. The value was 100x what I paid.” — Josh

Have a question right now? Most of my Clarity calls last less than 20 minutes. Let's set up a call.