Skip to main content
You can put SiteGPT where visitors expect a search box, for example on your home page or your help center. The chatbot then answers the question from your content, in the chat. SiteGPT has no separate search bar embed. There are two ways to do this with the chat widget:

Before you start

  • Role: Manager or higher on the chatbot to copy the code from the Installation page. See Invite and manage team members.
  • Access to the HTML of your page, or to a block or element in your website builder that takes HTML and scripts.
  • Your chatbot ID. It is on the Installation page.

Show the chat inside the page

Use the inline container. The chat shows in a box on your page, and the floating chat icon does not show.
1

Copy the Inline Container code

On the Installation page, in Embed Options, find Inline Container. Select Copy.
2

Paste the code where the search box goes

Paste the code in your page, at the place where you want visitors to ask. For a search-style box, make the container shorter, for example height: 400px.
3

Remove the other embed code from that page

If this page also has the JavaScript embed code, remove it from this page. The inline code already loads the chat with hideBubble=true.
The code looks like this:
To change what the chat says before the visitor asks, for example a welcome message or starter questions, see Conversation starters. For more about the inline container, see Show the chat inside a page.

On WordPress

The plugin already loads the chat on every page. Add only the container.
  1. Open the page in the WordPress editor.
  2. Add a Custom HTML block where the search box goes.
  3. Paste only the <div> line of the code, not the <script>.
  4. Update the page.
The plugin also shows the floating chat icon on this page. To hide the icon on this page only, add the page path to Excluded Pages. Excluded Pages does not hide the chat inside the page.

Send your search bar to the chat

Keep your own search box. When the visitor submits it, your page sends the text to the chat with the widget SDK. The chat window opens, sends the question, and shows the answer. You do not need to open the chat first.
1

Add the embed code to the page

The page needs the normal JavaScript embed code, or the WordPress plugin. See Add SiteGPT to your website. If the chat icon already shows on the page, this is done.
2

Add the search box and the script

Paste this code where the search box goes. You can change the label, the placeholder, the button text, and the style.
3

Test it

Open the page, type a question in the search box, and press Enter or select Ask.
How it works:
  • The script listens for the form’s submit on the whole page, so it works above or below the form, in the header or in the footer.
  • event.preventDefault() stops the form from loading a search results page.
  • window.$sitegpt.push(['do', 'message:send', question]) sends the text as the visitor’s message. The answer shows in the chat window.
  • Each question goes into the visitor’s current conversation, so the visitor can ask follow-up questions in the chat.
  • A visitor message has a length limit. If the text is too long, the chat does not send it and shows an error. See Chat message length.
To show only your search box and not the chat icon, add hideButton=true to the script URL of the embed code: .../widget/YOUR_CHATBOT_ID.js?hideButton=true. The chat window still opens when the visitor submits the search box. See Embed code options.

On WordPress

  1. Install the SiteGPT plugin, or check that it is active. See Add SiteGPT to your website.
  2. Open the page in the WordPress editor.
  3. Add a Custom HTML block where the search box goes.
  4. Paste the search box code from above.
  5. Update the page.
If WordPress removes the <script> when you save, keep the <form> in the block. Then add the <script> part to the footer with a plugin that adds header and footer code. The plugin adds the chat with its default options, so the chat icon stays on the page. Do not add this page to Excluded Pages. On an excluded page, the chat does not open from your search box.

Check that it works

  1. Open the page in a new private browser window.
  2. Ask a question that your content answers.
  3. The chat shows the question and the answer.

If it does not work

  • Check that the embed code or the WordPress plugin is on the page. View the page source and search for sitegpt.ai/widget.
  • Check that the id values in the form and the script match.
  • If the page is in Excluded Pages, the chat does not open there, unless the embed code uses hideButton=true or hideBubble=true. Remove the page from Excluded Pages. See Hide the chat icon on some pages.
  • If you set Allowed Domains, your website’s domain must be in the list. See Allow only your own websites.
  • Open the browser console. Messages from SiteGPT start with SiteGPT:.
The script did not run, so the form did its normal submit. Check that the <script> is on the page and that your website builder did not remove it. Check that the form has id="sitegpt-search".
The page has the normal embed code, or the WordPress plugin, as well as the inline code. Remove the normal embed code from that page. With the WordPress plugin, add the page to Excluded Pages.