1
Open your HTML file
Open the HTML file (or template) that renders every page you want the widget on — typically your shared layout or
index.html.2
Paste the snippet before </body>
Add the script tag immediately before the closing Replace
</body> tag:kb_xxx with your knowledge base ID and bq_pk_... with your public client key.3
Open the page in a browser
Load or refresh the page. You should see the “Ask AI” launcher button appear in the bottom-right corner within a moment of the page becoming interactive.
Get your keys — your knowledge base ID and public client key (
bq_pk_...) are in the BeforeQuery dashboard under Knowledge Base → Integration. Create a client key there and add your site’s domain to the key’s origin allowlist so requests are accepted.