Skip to content

Script Initialisation

Web components

The first step in enabling the web components is to add the component library and initialisation code to the website. It is recommended to place them inside the <head>-tag.

  <script src="" type="module"></script>
  <script src="" nomodule defer></script>
  <script src="init-esales-lifestyle.js" defer></script>

Performance optimisation

The eSales Lifestyle components are often displaying critical content (e.g. search results). It is therefore important that the script is not blocked by other JavaScript code.

  • Use the defer attribute on all non-critical other script tags.
  • Include the eSales Lifestyle scripts as early as possible, before any non-critical scripts.
  • Keep the number and size of synchronous script tags low

Within this context, non-critical scripts refers to code not producing any critical visual changes.

Before the components can be used, they require an initialisation configuration. This is done via the esales.init function which will link the components to a specific eSales cluster and market. It is recommended to add this code snippet to a file, for example init-esales-lifestyle.js.

// init-esales-lifestyle.js
  webApiId: '{cluster-Id}',
  market: '{market}',
  searchPageUrlPrefix: '',

When the above script has executed, the Web Components are bootstrapped and ready to be used. The full specification of the init parameters can be seen in the Library API.

Live sample integration

To view a sample integration, see Live examples.

Live examples

Note that the live examples are password protected. Retailers should contact their appointed Apptus Success Manager to gain access to password protected content.

Last update: December 1, 2020

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.