Docusaurus’s scripts config option injects <script> tags into every page. You can pass arbitrary attributes — including data-* attributes — as object keys alongside src and async.
1

Open docusaurus.config.js (or .ts)

Open docusaurus.config.js (or docusaurus.config.ts) at the root of your Docusaurus project.
2

Add the scripts entry

Add or extend the top-level scripts array in your exported config object:
docusaurus.config.js
Replace kb_xxx and bq_pk_... with your actual values. If you already have entries in scripts, append this object to the array.
3

Restart the dev server

Run npm run start (or yarn start) to restart. Inspect the rendered <head> or <body> to confirm the script tag is present, then verify the launcher appears on the page.
Docusaurus injects scripts entries into <head> by default. The BeforeQuery widget is async and runs after the DOM is ready, so <head> placement is fine — the launcher will still render in the bottom corner of the page.
Get your keys — your knowledge base ID and public client key (bq_pk_...) are in the BeforeQuery dashboard under Knowledge Base → Integration. Add your Docusaurus site’s domain to the key’s origin allowlist.
For all widget configuration options, see Widget reference.