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
- Create the shop in the account portal
- Verify the shop
- Enter the product feed
- Add the script tag
- Map the search field, if needed
Requirements
- An account in the account portal
- Access to your shop's HTML template
- A product feed in the Findiyra format
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:
https://your-shop.com/findiyra-verification.txtThen 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.
<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:
- Different search field selector: a CSS selector you enter under Settings › Shop › Search & relevance › Behaviour, for example
#search input[type="search"]. - Default of your shop system: For some systems, Findiyra already knows the search field.
- A field with the ID
shop-search-input: If Findiyra finds nothing else, it takes this field.
| Shop system | Search 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:
<input type="search" id="shop-search-input" name="search" placeholder="Search ...">Pass on consent
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:
window.FindiyraConsent(true); // agreed
window.FindiyraConsent(false); // declined or withdrawnThe 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
| Problem | Solution |
|---|---|
| The Findiyra search doesn't show up | Is 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 field | Findiyra doesn't find your search field. Enter the selector under Search & relevance › Behaviour or give the field the ID shop-search-input. |
| "Verify shop" fails | Can 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 error | Allow https://api.findiyra.com for scripts, styles, images and connections. |
| Statistics stay empty | Does your cookie banner call window.FindiyraConsent(true) when the visitor agrees? |