JS | New events to hook into for Javascript
February 5th, 2024
We have added new events that are being fired at different points of using the JS Implementation and JS Suggestions. These can be used to hook into for implementing custom functionality and business logic.
JS Implementation
- The
twn.product.visible
event is fired when a product tile is visible on the screen (technically it goes for the middle pixel on the entire tile, so you must scroll at least 50% for this event to be fired). - The
twn.product.click
event is fired when a link is clicked on the product tile (right click or middle click; any anchor tag including the one on the product image).
These events are useful for additional tracking the impressions of for example products fetched from an external source.
Suggestions JS
twn.request.started
- Request to fetch suggestions has startedtwn.request.products.started
- Request to fetch product suggestions has startedtwn.request.success
- Request to fetch suggestions has succeededtwn.request.products.success
- Request to fetch product suggestions has succeededtwn.request.failed
- Request to fetch suggestions has failedtwn.request.products.failed
- Request to fetch product suggestions has failedtwn.request.completed
- Request to fetch suggestion has been completedtwn.request.products.completed
- Request to fetch product suggestions has been completed
Series of events following the lifecycle of requests to fetch the suggestion data.
Read our complete Tweakwise JS documentation for more information on how to implement this.