Client-side APIs
Recommendations
GF.Recommendations.get(id, opts, callback)GF.Recommendations.get('6364138cfe9b4f979a044a32', {
maxProducts: 10
}, function(err, data) {
if (err) {
console.log(err);return;
}
const template = '<a href="{url}" class="demo-recs__item" style="flex:1;margin:0 5px;border: 1px solid #ccc;padding:10px;background: #fff;"><img src="{image_url}" style="display:block;max-width:100px;height:auto;max-height:100px;margin:0 auto;"/><div>{name}</div><div>{price}</div></a>';
let html = '<div class="demo-recs" style="display:flex;">';
for(let i = 0; i < data.slots.length; i++) {
html += template.replace(/{([^{}]+)}/g, function(keyExpr, key) {
return data.slots[i].item[key] || "";
});
}
html += '</div>';
document.body.insertAdjacentHTML('afterbegin', html);
})Wait for a CSS Element
Wait for an event
Overlay
Social Proof and Product Data
Last updated