Skip to main content
The chatbot runs in a small window that one script adds to your page. Copy the script from the dashboard, paste it into your site once, and the chat bubble appears on every page that includes it.

Copy the embed code

  1. In My Chatbots, click your chatbot. The dashboard selects it and opens Customizer.
  2. Scroll to Get Embed Code.
  3. Choose a tab and click Copy Code.

HTML script

Paste it just before the closing </body> tag on every page where the chat should appear. If your site has a shared footer or layout template, paste it there once. The script adds a chat bubble 20 px from the bottom-right corner, on top of your page’s content. Clicking it opens a chat panel about 380 × 640 px. If the tag appears twice on a page, the second copy does nothing. The position of the bubble can’t be changed yet.

Script options

Next.js

Put it in the root layout so it loads once for the whole app. The widget notices client-side route changes on its own.

IFrame

The iframe fills its container, so give the container a height, for example height: 640px.

Where the widget is allowed to load

The widget works only on the domain you entered as Website Domain Link when you created the chatbot, and on its subdomains. On any other site, the chat panel shows Embedding not allowed on this origin.
  • With https://acme.com, the widget works on acme.com, www.acme.com, and help.acme.com.
  • With https://www.acme.com, it works on www.acme.com but not on acme.com. If your site answers on both, enter the domain without www.
  • It always works on localhost and 127.0.0.1, so you can test before you publish.
The dashboard has no field for changing the domain yet. With the CLI (plans with API access), run:
On other plans, email support@customergpt.ai.

Content Security Policy

If your site sends a Content-Security-Policy header, add the widget’s origin to two directives, next to the sources you already allow:

Troubleshooting

  • Open your published page, view its source, and search for embed.js. Site builders often need you to publish again after you add code.
  • Open the browser console. CustomerGPT: Missing data-widget-id attribute on script tag. means the attribute was lost, often because a plugin rewrote or combined your scripts. Exclude widget.customergpt.ai/embed.js from that plugin.
  • An error that mentions Content Security Policy means your CSP blocks the widget. See Content Security Policy.
The page’s domain doesn’t match the chatbot’s Website Domain Link. See Where the widget is allowed to load.
The widget couldn’t load your chatbot’s settings, usually because the Widget ID in the code is wrong. Copy the code again from Customizer.