Skip to main content
The chat works without any consent call. To recognize returning visitors in your analytics, homie needs your visitors’ consent for statistics. Your consent management platform (CMP) collects that consent, and you pass it to homie with window.homieBot.setConsent(). homie does not remember the consent. Report it on every page view, as soon as the Client API is ready (homiebot:api-ready), and again whenever the visitor changes their choice in your CMP. Until your call arrives, homie treats the visitor as not consenting. Each example below does two things:
  1. When the Client API is ready, it reads the current consent from your CMP and passes it to homie.
  2. It listens for the CMP’s own consent event and passes every change to homie.
Do not block the homie script in your CMP. Many CMPs can block scripts automatically by category. If you put the homie script under “Statistics”, the whole chat disappears for every visitor who declines statistics. Classify the script as strictly necessary (“Essential” or “Necessary” in most CMPs), and control analytics only through setConsent. In most CMPs, the “Functional” or “Preferences” category also requires consent.

Examples for common CMPs

All examples use this helper, which runs your code once the Client API is ready, whether the embed script has already loaded or not:
Add homie as a service in your Usercentrics settings and use that service’s ID.
usercentrics.js
Accept statistics in your CMP and reload the page. In your browser’s developer tools, the chat’s local storage contains homie.visitor after you open the chat. Withdraw consent and open the chat again: the entry is gone.
Some shops load the whole homie script only after the visitor has consented to statistics. In that case, the consent is given whenever the script runs. Report it directly:
With this setup, visitors without consent see no chat at all. To offer the chat to every visitor, load the script as strictly necessary (“Essential” or “Necessary”) and use one of the examples above.

Reference

Passes the visitor’s statistics consent to homie. Returns void. Any other value is ignored and logged as a warning in the browser console. Calling setConsent again with a new value replaces the previous one.