Skip to content

Add the script tag ​

For shops without a ready-made plugin, you add Findiyra with a single line. The script loads the search and connects it to the search field your shop already has. You don't build a new search field, and your current one stays as a fallback.

The steps at a glance

  1. Create the shop in the account portal
  2. Verify the shop
  3. Enter the product feed
  4. Add the script tag
  5. Map the search field, if needed

Requirements ​

1. Create the shop ​

In the account portal, open Settings › Shop and create your shop. Then you find your public API key under Settings › Shop › API access. You need it in the next steps.

2. Verify the shop ​

Without a plugin, you confirm with a file that the shop is yours. Put a file findiyra-verification.txt into the root directory of your shop that contains your public API key:

text
https://your-shop.com/findiyra-verification.txt

Then click Verify shop in the shop wizard.

Leave the file in place

Findiyra checks the file again regularly. If you remove it, the shop no longer counts as verified, and the search is no longer delivered.

3. Enter the product feed ​

Enter the address of your product feed in the shop wizard. How the feed must be built is described under Product feed (XML format). Before the search goes live, you sign the data processing agreement once and activate the shop.

4. Add the script tag ​

Add this line to the template that is loaded on every page of your shop, best right before </body>. Replace YOUR_API_KEY with your public API key.

html
<script src="https://api.findiyra.com/ais-search-api/v1/shop/YOUR_API_KEY.js" defer></script>

The script is small and loads the actual search afterwards. With defer it doesn't block the page from loading. It is never cached, so your visitors get the new version automatically after an update of Findiyra.

The public API key may be public

The public API key is in the source code of your page, that is intended. Never put the secret key in code that runs in the browser.

5. Map the search field ​

The search connects to the existing search field of your shop. It looks for it in this order:

  1. Different search field selector: a CSS selector you enter under Settings › Shop › Search & relevance › Behaviour, for example #search input[type="search"].
  2. Default of your shop system: For some systems, Findiyra already knows the search field.
  3. A field with the ID shop-search-input: If Findiyra finds nothing else, it takes this field.
Shop systemSearch field Findiyra expects
Shopware 6.header-search-input
WooCommerce.woocommerce-product-search input[type="search"]
xt:Commerce 5 and 6.box-search input[type="search"]
Shopify#Search-In-Modal input[type="search"]
WordPress#search-2 input[type="search"]

For a custom shop system, the ID is the easiest way:

html
<input type="search" id="shop-search-input" name="search" placeholder="Search ...">

For statistics across visits, Findiyra needs the visitor's consent. You get it through your shop's cookie banner. As soon as the visitor agrees or declines, call:

js
window.FindiyraConsent(true);  // agreed
window.FindiyraConsent(false); // declined or withdrawn

The function is available as soon as the script has loaded. The former name window.AISearchConsent still works. The function sets the cookie findiyra-analytics, which is read again on the next page view. Without consent the search works just the same, Findiyra then only stores what the search itself needs. More under Consent & tracking.

Fail-safe ​

If your shop is paused, not active yet or Findiyra can't be reached, the search does not connect to your search field. Your current shop search simply keeps working.

Troubleshooting ​

ProblemSolution
The Findiyra search doesn't show upIs the shop active and verified in the account portal? Is the API key in the script tag correct?
The search doesn't open when clicking into the search fieldFindiyra doesn't find your search field. Enter the selector under Search & relevance › Behaviour or give the field the ID shop-search-input.
"Verify shop" failsCan findiyra-verification.txt be opened in the browser under your shop address, and does it contain the public API key?
The page reports a Content Security Policy errorAllow https://api.findiyra.com for scripts, styles, images and connections.
Statistics stay emptyDoes your cookie banner call window.FindiyraConsent(true) when the visitor agrees?