Skip to content

Install the widget

One script tag puts the widget on your site. Your widget type, look and collections come with it, and so does the AI Assistant when it is on.

  • A collection with documents in it.
  • Your site under Security → Allowed domains. The widget searches only on the sites listed there; a page on localhost works without being listed. See Widget allowed domains.
  • On WordPress or WooCommerce, the plugin installs the widget for you, so you can skip this page.
  1. Copy the snippet. Open Install → Installation and copy the Install snippet under Add the script to your site. It carries your project’s Read only key.

    Install → Installation: Where the widget runs with three domains, each with a Verify button, then the Install snippet with its copy button, and links to the WordPress plugin and the installation guide
    Install → Installation

    If the page shows No Read only key, click Create API key first.

  2. Paste it before </body> on every page that should have search. That is usually your theme template, your layout file or a site builder’s footer code.

    <script src="https://search.typemo.com/loader.js?k=YOUR_API_KEY" async></script>
  3. Connect your search button. Add data-target-element with a CSS selector for the button or field that should open search:

    <button id="search-button">Search</button>
    <script
    src="https://search.typemo.com/loader.js?k=YOUR_API_KEY"
    data-target-element="#search-button"
    async
    ></script>

    Without it, visitors open search only with ⌘K, Ctrl+K or /. Embed options lists the other attributes.

  1. On Install → Installation, click Verify next to your domain. The first domain is checked when the page opens.

    ResultWhat to do
    Widget found on … — you’re live.Nothing.
    The page loads, but the snippet wasn’t found in its HTML.Paste the snippet, or see the next section if a script adds it.
    A Typemo script was found, but with a different key than this project’s.Replace the tag with this project’s snippet.
    The snippet on this page carries a Write & Read key, which the widget refuses.Replace the tag with this project’s snippet; only a Read only key loads the widget.
    Couldn’t reach …Check the address in Security → Allowed domains and that the site is up.
  2. Open your site, click your search button and type a few letters.

  • A tag manager or your app’s code can add the tag. The snippet finds itself by its address. Verify reads only the page’s HTML, so it misses such a tag: try a search on the site instead.
  • Add the tag once, in the layout every route shares. Adding it again on a route change does nothing.
  • A button rendered later isn’t connected. data-target-element connects the elements on the page when the widget starts. For a button your app renders afterwards, call typemoInstance.open() from its click handler. See the JavaScript API.

Open the browser console on your site and look for a message from Typemo, or a failed request in the Network tab.

What you seeCauseFix
Typemo: /init answered HTTP 404, widget not loadedThe key in k= is unknown or was deletedCopy the snippet from Install → Installation again
Typemo: Target element "#search-button" not foundNothing on the page matches data-target-elementFix the selector, or open search from code as above
A search request answers 403The site isn’t under Security → Allowed domainsAdd it, including the staging sites you test on
No message and no widgetSearch → Setup is set to API only and the AI Assistant is offPick Catalog or Docs, or turn the assistant on

To confirm the widget started, add data-debug="true" to the tag: the console then logs a line starting with Typemo: initialized. Remove it when you’re done. The widget doesn’t load covers the remaining causes.

Next: Match the widget to your brand, or connect the cart button on a store.