Recommendations JS supports a couple of events to hook into specific moments in the plugin.
Lifecycle events
twn.request.started
Request to fetch Recommendations started.
tweakwiseGuidedSelling({
// ...
on: {
// ...
'twn.request.started': function (event) {
// handle event
}
}
});
twn.request.success
Request to fetch Recommendations succeeded.
twn.request.failed
Request to fetch Recommendations failed.
twn.request.completed
Request to fetch Recommendations completed.
This executes for both success and failed requests.
Product specific events
After default results are displayed, these regular product events can be used.
Event Name | Description |
---|---|
twn.add-to-cart | Add to cart button was clicked |
twn.add-to-favorites | Add to favorites button was clicked |
twn.product.visible | Product tile is visible on a screen |
twn.product.click | A link on a product tile has been clicked |
For detailed examples, see Product specific events on Search & Merchandising.