Advanced embeddingBeta
Inline iframe or floating button, script attributes, language detection, and opening the chat from your own page
This feature is in beta. It is usable, but details can still change.
The snippet from Install on your website covers most sites. This page is for web teams who want more control over where and when the chat appears.
Floating button or inline embed
Install offers two snippets:
| Variant | What it does | Use it when |
|---|---|---|
| Floating chat button (script) | adds a button in a corner of every page; clicking it opens the chat in an overlay | the chat should be available everywhere on the site |
| Inline embed (iframe) | places the chat directly in the page flow, at the size you give the iframe | a dedicated help or contact page with the chat in the content |
The inline embed is a plain <iframe>. Adjust its width and height to your layout and keep allow="clipboard-write; microphone", which copy buttons and voice input need. The allowlist applies to both variants in the same way.
Script attributes
The floating button reads a few attributes from its own <script> tag:
| Attribute | Effect |
|---|---|
data-widget-id | which widget to load. Required, and already in the snippet. |
data-position | bottom-left or bottom-right. Overrides the position set under Identity for this page. |
data-primary-color | button colour used only when the widget configuration cannot be loaded. |
data-button-label | button label used only when the widget configuration cannot be loaded. |
Everything else comes from the published version, so a change in the builder never requires touching your site.
Pasting the snippet twice on one page is harmless: the loader starts only once.
Language
The loader reads the language of your page from <html lang="…">, falling back to the visitor's browser language. English pages get the English interface; everything else gets German. If Brain → Language is set to German or English, that setting wins.
Open the chat from your own page
Once the chat button has appeared, the loader provides a small scripting interface on window.DeutschlandGPTWidget:
| Method | Effect |
|---|---|
open() | opens the chat |
close() | closes it |
prefill(text) | opens the chat and puts text into the input field (loader 1.7.0+) |
toggle() | opens it when closed, closes it when open |
Use it to open the chat from your own "Chat with us" link. Check that the object exists first, because it is only there once the loader has finished:
<a
href="#"
onclick="window.DeutschlandGPTWidget && window.DeutschlandGPTWidget.open(); return false;"
>
Chat with us
</a>
The interface belongs to the floating button. The inline embed has no button to open or close.
Prefill a question
From loader 1.7.0, your page can put text into the chat input, for example from an "Ask about this product" button. The panel opens and the text is in the input field. It is never sent automatically; the visitor decides. If they have already typed something, the text is added on a new line.
window.DeutschlandGPTWidget.prefill('Question about the Pro plan');
// or, without waiting for the loader:
window.postMessage({ type: 'dgpt-prefill', text: 'Question about the Pro plan' }, location.origin);
Only messages from the page itself are accepted, not from other frames on it. The text is capped at 2,000 characters.
Page context
From loader 1.7.0, the widget tells the bot which page the visitor is on: the page title and its address without parameters. Nothing after ? or # is ever sent. The bot can then answer "what does this cost?" about the page in front of the visitor. It does not bring the page up on its own.
- It is sent to the AI model with each answer and is not stored in transcripts.
- It is accepted only for pages on your allowed domains.
- On single-page sites the widget follows client-side navigation.
- It is on by default for every widget, including existing ones, once your site uses the 1.7.0 snippet. Older snippets send nothing.
Switch it off under Behavior → Pass page context to the bot, then publish. The setup assistant can do it too.
Open state
From loader 1.7.0, a chat the visitor opened stays open when they move to another page in the same tab. A new visit starts closed. If the browser blocks storage, the widget simply starts closed every time.