Skip to main content
Any button on your site can open the Crossword chat. It can also ask a question for the shopper, such as “Help me pick the right product”. The chat widget must already be on your site. If it is not, add your environment’s installation snippet first.

Add the button

1

Add the helper script once

Add this script to every page, for example in your theme’s <head>. Add it once for the whole site.
The first part makes the button safe to click before the widget finishes loading. An early click is saved and runs once the widget is ready. askAI() works before and after the widget loads.
2

Add the button

To open the chat only:
To open the chat and ask a question for the shopper:
The question appears in the chat as the shopper’s message, and your Agent replies.
3

Style the button

It is a normal button, so style it with your own theme classes or CSS. The widget does not style it.
To show only your own button, turn on Hide the launcher under Launcher visibility in the widget settings. The closed widget then stays hidden until your button opens it.
4

Test the button

  1. Load a page and click the button. The chat opens.
  2. Hard-refresh the page and click the button straight away. The chat opens once the widget is ready.
  3. If your button asks a question, let the page finish loading, then click it. The question appears as the shopper’s message, and your Agent replies.

Available functions

askAI() uses these functions. You can also call them from your own code.
Pages that already use CrosswordAgent keep working. No change is needed.
To sign shoppers in and out from your site, read Shopper identity.

When the button does nothing

  • The page is hidden by your page rules. If your page rules hide the widget on a page, the button does nothing there. The click is not saved for later.
  • The chat is waiting for cookie consent. If you turned on Also block chat until consent is given, the button does nothing until the shopper accepts cookies. Clicks before that are not saved.
  • A capture sheet is due. If a capture sheet opens on the shopper’s first message, the question waits. It is sent once the shopper finishes the sheet.
  • Your page already uses the name Crossword. The widget always takes the name window.Crossword. If your page has its own Crossword, such as a script variable or an element whose id or name is Crossword, early clicks are lost. Rename yours.
  • The shopper clicked before the chat was ready. The chat opens, but the question may not be sent. The shopper can type it, or click the button again.