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.

AttributeAliasValueEffect
data-widget-idwidget_idThe 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-idagent_idAn AI agent IDLegacy. 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-urlapi_base_urlAn origin, for example https://api-us.zoie.aiOverrides 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-urlvoice_api_base_urlAn originRead but not used by the current bundle. Voice calls go through the API base.
data-analytics—offStops this install sending product-analytics events. See Analytics.
data-posthog-key—A PostHog project tokenSends this install’s analytics events to your own PostHog project instead.
data-posthog-host—A PostHog host, for example https://eu.i.posthog.comThe ingestion host for data-posthog-key. Defaults to https://us.i.posthog.com.
data-posthog-person-profiles—trueCreates PostHog person profiles for visitors. Events are anonymous without it.
data-ad-consentdata-zoie-ad-consentgranted or deniedYour visitor’s consent to sending their data for ad measurement. See Ad consent.
data-zoie-widget-force-enableddata-force-widget-enabledtrueTesting 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

AttributeValueEffect
form_idThe 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)

OptionTypeDescription
widget_idstringThe widget’s public key.
agent_idstringLegacy. See data-agent-id above.
api_base_urlstringAs data-api-base-url.
voice_api_base_urlstringAs data-voice-api-base-url.
force_widget_enabledboolean or stringAs 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)

OptionTypeDescription
form_idstringThe 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.

GlobalValueEffect
__ZOIE_WIDGET_DEBUG__trueLogs 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__trueOpts out of analytics.
ZoieWidgetConsent'granted', 'denied', or { ad_user_data: 'granted' }Ad consent. See Ad consent.
__ZOIE_WIDGET_FORCE_ENABLED__trueAs 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.

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:

  1. window.ZoieWidgetConsent, a string or an object with ad_user_data.
  2. The data-ad-consent attribute on the widget’s script tag.
  3. Google Consent Mode on your page’s dataLayer. The last consent default or update call that sets ad_user_data wins, 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:

RuleDetail
FormatOne entry per line. Commas and spaces also separate entries. A full URL such as https://www.example.com/contact is reduced to its host.
NormalisingHosts are compared in lower case, with any port and a leading www. removed, on both sides.
example.comMatches example.com and www.example.com. It doesn’t match other subdomains.
*.example.comMatches example.com and every subdomain, such as staging.example.com.
Empty listAny site may load the embed.
Request hostTaken from the Origin header, or Referer when there is no Origin. With a list set, a request carrying neither is refused.
Always allowedzoie.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" }
EmbedChecked when
Website widgetLoading 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 widgetLoading the form, and submitting it unless the request carries the form’s valid API key.