Guided Recs
Guided Recs is our questionnaire-based recommendations, where we develop a nominal profile based on the customer's selected choices.
There is one major difference between Get Recs and Guided Recs: Guided Recs does not require an identified Customer with a Profile.
Guided Recs calls are based on a specific Collection. The collection defaults to your primary inventory.
GuidedRec is a questionnaire that gets returned by Preferabli.main.getGuidedRec(guided_rec_id:onCompletion:onFailure:).
Each question GuidedRecQuestion of that questionnaire contains an array of choices GuidedRecChoice.
Present each question and matching set of choices to the user and gather their input. When the user is done with the questionnaire, you should be left with an array of selected choices.
Those choices are then used to generate results from Preferabli.main.getGuidedRecResults(guided_rec_id:selected_choice_ids:price_min:price_max:collection_id:include_merchant_links:onCompletion:onFailure:).
Here is an example of the whole process in one go:
Preferabli.main.getGuidedRec { guided_rec in
let questions = guided_rec.questions
var selected_choice_ids = Array<NSNumber>()
for question in questions {
if (question.choices.count > 0) {
// Here I am simply randomizing choices to get results. In the real world, the answers to these questions would come from the user.
selected_choice_ids.append(question.choices.randomElement()!.id)
}
}
Preferabli.main.getGuidedRecResults(guided_rec_id: guided_rec.id, selected_choice_ids: selected_choice_ids) { products in
// Do what you like with the products returned.
} onFailure: { error in
// Call failed.
}
} onFailure: { error in
// Call failed.
}Updated about 1 year ago
