Configuration
Reference for every option the Zoie embed scripts read: script-tag attributes, the initStaticWidget and initFormWidget start-up functions, page-level globals for debugging, analytics and ad consent, and how Allowed Domains are matched.
Almost everything about a widget or form is configured in the Zoie app: the agent, greetings, lead capture, colours, fields. The options on this page are the few things you control from the page that embeds it. To change what the widget looks like or says, see Widget setup and Widget appearance.
Website widget attributes
Set these on the <script> tag that loads widget-bundle.js. Most have a data- form and an older bare form. Both work.
| Attribute | Alias | Value | Effect |
|---|---|---|---|
data-widget-id | widget_id | The widget’s public key (a UUID) | Required. Picks the widget to load. Older embeds that carry the widget’s numeric ID still work. |
data-agent-id | agent_id | An AI agent ID | Legacy. With no widget ID, Zoie loads that agent’s most recently updated active widget. Current snippets leave it out, because the embed breaks if that agent is later deleted or moved to another widget. |
data-api-base-url | api_base_url | An origin, for example https://api-us.zoie.ai | Overrides the API the widget talks to. The bundle already points at the right API, so only set this if Zoie support asks you to. http:// is upgraded to https:// except on localhost. |
data-voice-api-base-url | voice_api_base_url | An origin | Read but not used by the current bundle. Voice calls go through the API base. |
data-analytics | — | off | Stops this install sending product-analytics events. See Analytics. |
data-posthog-key | — | A PostHog project token | Sends this install’s analytics events to your own PostHog project instead. |
data-posthog-host | — | A PostHog host, for example https://eu.i.posthog.com | The ingestion host for data-posthog-key. Defaults to https://us.i.posthog.com. |
data-posthog-person-profiles | — | true | Creates PostHog person profiles for visitors. Events are anonymous without it. |
data-ad-consent | data-zoie-ad-consent | granted or denied | Your visitor’s consent to sending their data for ad measurement. See Ad consent. |
data-zoie-widget-force-enabled | data-force-widget-enabled | true | Testing only. Draws the launcher even when AI is off for the widget channel. The API still refuses to start chats while it’s off. |
true, 1 and yes all count as true for the flag attributes.
<script
src="https://us.zoie.ai/widget-bundle.js"
data-widget-id="3f6b2a9e-1c4d-4e8f-9a7b-5d2c1e0f4a6b"
data-ad-consent="denied"
defer>
</script>
Form widget attributes
| Attribute | Value | Effect |
|---|---|---|
form_id | The form’s ID (a UUID) | Required. Picks the form to show. There is no data-form-id form of this attribute. |
The form widget reads no other attributes. Where the form appears is decided by its container. See Choose where the form appears.
Start-up functions
Each bundle defines a global function and calls it for you when it finds a tag with an ID. Call it yourself only when you load the bundle without one, for example after a visitor accepts cookies.
window.initStaticWidget(options)
| Option | Type | Description |
|---|---|---|
widget_id | string | The widget’s public key. |
agent_id | string | Legacy. See data-agent-id above. |
api_base_url | string | As data-api-base-url. |
voice_api_base_url | string | As data-voice-api-base-url. |
force_widget_enabled | boolean or string | As data-zoie-widget-force-enabled. |
Options you leave out are filled from any <script> tag on the page that carries widget attributes. With neither a widget ID nor an agent ID, the widget logs “Cannot start: both agent_id and widget_id are missing” to the console and does nothing. Call it once per page.
window.initFormWidget(options)
| Option | Type | Description |
|---|---|---|
form_id | string | The form’s ID. Without it, the first <script> tag with a form_id attribute is used. |
With no form ID anywhere, the console shows “Missing form_id” and nothing renders.
Page-level globals
Set these on window before the bundle runs, for example in an inline script above the snippet.
| Global | Value | Effect |
|---|---|---|
__ZOIE_WIDGET_DEBUG__ | true | Logs each start-up step and every analytics event to the console, prefixed [ZoieWidget]. |
__ZOIE_WIDGET_ANALYTICS__ | { key, host, enabled, debug, personProfiles } | The same analytics settings as the attributes. enabled: false opts out. |
__ZOIE_WIDGET_ANALYTICS_DISABLED__ | true | Opts out of analytics. |
ZoieWidgetConsent | 'granted', 'denied', or { ad_user_data: 'granted' } | Ad consent. See Ad consent. |
__ZOIE_WIDGET_FORCE_ENABLED__ | true | As data-zoie-widget-force-enabled. |
<script>
window.__ZOIE_WIDGET_DEBUG__ = true;
</script>
<script src="https://us.zoie.ai/widget-bundle.js" data-widget-id="3f6b2a9e-1c4d-4e8f-9a7b-5d2c1e0f4a6b" defer></script>
For analytics, __ZOIE_WIDGET_ANALYTICS__ takes precedence over the script-tag attributes, and both take precedence over the project key built into the bundle. Any opt-out wins over everything.
Ad consent
When a chat, call or form creates a lead, the embed sends the visitor’s UTM parameters and Google Ads click IDs (gclid, gbraid, wbraid) with it, so a booking can be reported back to Google Ads. It also sends an ad-consent state, but only when your page has stated one. It looks in this order:
window.ZoieWidgetConsent, a string or an object withad_user_data.- The
data-ad-consentattribute on the widget’s script tag. - Google Consent Mode on your page’s
dataLayer. The lastconsentdefaultorupdatecall that setsad_user_datawins, so a later update from your consent banner overrides the default.
If none of these is set, no consent value is sent and Zoie falls back to the business’s own default. When consent is denied, a click ID is still sent with the current request but isn’t saved in the visitor’s browser.
Allowed domains
Widgets and forms each have an Allowed Domains box in the app: on the widget’s Setup tab, and on the form’s Embed Code tab. See Allowed Domains. This is how Zoie matches it:
| Rule | Detail |
|---|---|
| Format | One entry per line. Commas and spaces also separate entries. A full URL such as https://www.example.com/contact is reduced to its host. |
| Normalising | Hosts are compared in lower case, with any port and a leading www. removed, on both sides. |
example.com | Matches example.com and www.example.com. It doesn’t match other subdomains. |
*.example.com | Matches example.com and every subdomain, such as staging.example.com. |
| Empty list | Any site may load the embed. |
| Request host | Taken from the Origin header, or Referer when there is no Origin. With a list set, a request carrying neither is refused. |
| Always allowed | zoie.ai and its subdomains, localhost and 127.0.0.1, so the app’s previews and hosted pages keep working. |
A refused request gets this response:
{ "success": false, "message": "origin_not_allowed" }
| Embed | Checked when |
|---|---|
| Website widget | Loading its settings, starting a chat, sending each message and starting a voice call. A website you switch off in the Publish dialog is refused even when the list is empty. |
| Form widget | Loading the form, and submitting it unless the request carries the form’s valid API key. |