Facet suggestions are not displayed out-of-the-box. A handle function should be implemented that directs the user to the correct page when the user selects these suggestions.
<script>
window.addEventListener("twn.suggestions.ready", function () {
window.tweakwiseSuggestions({
//..
facetFilters: {
handle(event) {
var suggestion = event.data;
// Handle facet suggestion here...
}
}
});
});
</script>Example: brand suggestion
<script>
window.addEventListener("twn.suggestions.ready", function () {
window.tweakwiseSuggestions({
//..
facetFilters: {
handle: function (event) {
const filterContext = event.data.navigationLink.context.facetFilters[0];
if(filterContext.key == 'ae-brand'){
const value = filterContext.values[0];
let brandFixedForUrl = brand.replace(/['"]/g, '').replace(' ', '-').toLowerCase();
window.location.href = `/brands/${brandFixedForUrl}`;
}
else {
location.href = '/search#twn|?tn_q=' + e.data.match;
}
}
}
});
});
</script>