Skip to content

Events API

This section lists available events and event details for custom usage. This can for example be used for custom tracking for Google Analytics or third party vendors. For each event an example of how to listen and print the details of the event in the console, along with a specification of the event details.

Additional events

Tracking of additional events with an eSales Fashion component will be added largely based upon customer demand. To make a request or provide feedback, a retailer must contact their appointed Apptus service personnel.

Event specification

esales-product-suggestion

The event esales-product-suggestion is dispatched whenever a customer clicks on a product suggestion in the search assistant.

Usage example

document.body.addEventListener('esales-product-suggestion', function(e) {
  console.log(e.detail);
});

Detail specification

Event details Type Description
productKey string The product key of the clicked product suggestion.
searchPhrase string The search phrase used, resulting in the product suggestion.

Asynchronous code

Please note that since some events (e.g. esales-product-suggestion) will be followed by a navigation to a new page, it is not certain that asynchronous code has time to complete. There are various ways to handle this, e.g. navigator.sendBeacon(), LocalStorage queue, synchronous XMLHttpRequest. Google Analytics has an option transport: 'beacon' which should send events correctly.

esales-active-category

The event esales-active-category is dispatched whenever a category result is loaded. This is whenever loading a page with a esales-navigation-page component or when the component result is updated, for example when switching category by using the esales-category-navigation component.

Usage example

document.body.addEventListener('esales-active-category', function(e) {
  console.log(e.detail);
});

Detail specification

Event details Type Description
categoryName string The name of the category that was loaded.

esales-products-rendered

The event esales-products-rendered is dispatched whenever a product list of any sort is loaded, such as a search result, results for a navigation page, or recommendations.

Usage example

document.body.addEventListener('esales-products-rendered', function(e) {
  console.log(e.detail);
});

Detail specification

Event details Type Description
productKeys [string] An array of all product keys to the resulting products.

All product keys in the listing are always returned. For example, given a search result initially displaying 60 products, with 60 additional products being displayed upon a user pressing 'Load more', two events will be dispatched. The first event containing an array of 60 product keys and the second event an array containing 120 product keys.

esales-product-quick-buy

The event esales-product-quick-buy is emitted whenever a visitor clicks a Quick buy button in a product card.

Usage example

document.body.addEventListener('esales-product-quick-buy', function(e) {
  console.log(e.detail);
});

Detail specification

Event details Type Description
productKey string The product key of the product with the clicked Quick buy button.
productGroup string The product group of the product with the clicked Quick buy button.
elementRect DOMRect object The returned Quick buy button coordinates and dimensions as a DOMRect object.

Example integration

Below a sample integration of sending product suggestion clicks to Google Analytics is illustrated.

document.body.addEventListener('esales-product-suggestion', function(event) {
  ga('send', {
    hitType: 'event',
    eventCategory: 'product-suggestion',
    eventAction: 'click',
    eventLabel: event.detail.productKey,
    transport: 'beacon'
  });
});
×
Copyright

This online publication is intellectual property of Apptus Technologies. Its contents can be duplicated in part or whole, provided that a copyright label is visibly located on each copy and the copy is used in conjunction with the product described within this document.

All information found in these documents has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither Apptus Technologies nor the authors shall be held liable for possible errors or the consequences thereof.

Software and hardware descriptions cited in these documents might be registered trademarks. All trade names are subject to copyright restrictions and may be registered trademarks. Apptus Technologies essentially adheres to the manufacturer’s spelling. Names of products and trademarks appearing in this document, with or without specific notation, are likewise subject to trademark and trade protection laws and may thus fall under copyright restrictions.

CLOSE