Events

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 NameDescription
twn.add-to-cartAdd to cart button was clicked
twn.add-to-favoritesAdd to favorites button was clicked
twn.product.visibleProduct tile is visible on a screen
twn.product.clickA link on a product tile has been clicked

For detailed examples, see Product specific events on Search & Merchandising.