English
English
Appearance
English
English
Appearance
In the e-shop template, ideally before </body>:
<script type="module" src="https://widget.metty.eu/v1/metty.js?api=<PUBLIC_API_KEY>"></script>That completes the integration. The widget loads, picks up its configuration from the server and attaches to the e-shop's search input; you do not call any init function.
The api parameter is your public key. It may stay in the HTML — it does not grant write access to the catalog.
The widget binds to the existing search input through a DOM selector stored in its configuration, for example .search-form input[type="search"]. The input stays where it is and keeps its appearance — the widget only adds a results panel to it.
If search is hidden behind an icon on mobile, the configuration also holds the selector of that toggle so the widget can open the input.
We set the selectors up for your site. If the e-shop template changes and the selectors stop matching, get in touch.
| parameter | meaning |
|---|---|
api | required public key <PUBLIC_API_KEY> |
id | slug of the widget configuration (for example prod, stag); without it we serve the one marked as active |
<script type="module" src="https://widget.metty.eu/v1/metty.js?api=<PUBLIC_API_KEY>&id=prod"></script>The id parameter does not select a version but one of your configurations. /v1/metty.js always serves the current build of the configuration you chose, so a new widget release requires no change on your side.
If you need a pinned version, for example during a security audit, we can give you an immutable link to a specific build in the form https://widget.metty.eu/v1/b/<template>-<hash>.mjs. Such a link never changes — but it never updates either.
widget.metty.eu or search.api.metty.eu.If your e-shop has a CSP, allow the following sources:
script-src https://widget.metty.eu
connect-src https://search.api.metty.eu
img-src https:
style-src 'unsafe-inline'The widget loads both its configuration and search results from search.api.metty.eu; it never reaches catalog.api.metty.eu. Product images are served by your e-shop, or as thumbnails from search.api.metty.eu — img-src https: covers both.
The style-src 'unsafe-inline' directive is required because the widget injects its styles as a <style> element into its own shadow root. They never reach your page — the shadow root isolates them in both directions. The widget does not download external fonts, so there is no need to widen font-src because of it.