Visitor recognition

How Webchat recognizes returning visitors and the consent that governs the visitor cookie.

Webchat tracks two layers of identity:

  • Visitor: a stable anonymous identifier. Present for every visitor, signed-in or not.
  • Contact: the identified person behind the visitor, created or matched by identification.

When the widget boots it reads the visitor's anonymous ID, or creates one on the first visit, and stores it under the key assistify.<widgetId>.vid on your website's own origin:

StorageNotes
CookiePath=/, SameSite=Lax, Secure on HTTPS, Max-Age 180 days, renewed on each visit.
localStorageA copy with no expiry, which restores the cookie after it expires.
sessionStorageA copy for the current tab, and the only one when consent is denied.

reset() and an explicit deny remove the cookie and the localStorage copy. The server uses this value to bind the visitor's session to a Contact once one exists. Later visits restore the conversation list as long as a stored copy survives.

Read the current ID:

widget.user.getVisitorId();   // 'anon_aB3xY...'  or null

null means there is nothing to read yet, or nowhere to read it from. The runtime creates the ID on its first boot, so before that point (or before load() under autoload: false) no ID exists, and storage can be unavailable in private browsing, in a sandboxed iframe, or in a browser with storage blocked. An undecided consent state does not return null: the ID is stored by default.

The visitor ID keeps the chat consistent across pages, restores a returning visitor's conversations, and is the browser your team sees in the visit history and that campaigns count. It is persistent by default: only an explicit deny moves the widget to an ID kept for the current tab.

Consent decisionWhere the ID livesSurvives
granted or unknown (default)Cookie + localStorageAcross visits
deniedsessionStorage onlyThe current tab, gone when it closes

In session-only mode the chat keeps working for the current visit, but the visitor is not recognized on the next one.

Grant or withdraw at runtime:

window.Assistify.setConsent(true);    // re-enable: the visitor ID is promoted to cookie + localStorage
window.Assistify.setConsent(false);   // opt out: cookie, localStorage copy, drafts and preferences deleted; a tab-only ID from now on
window.Assistify.getConsent();        // the decision recorded by setConsent: 'granted' | 'denied' | 'unknown'

Both calls are safe at any time, including before the widget has booted: the loader records the decision immediately, and boot honors it, so an early setConsent(false) means the persistent cookie is never written at all.

The widget also reads the page's IAB TCF v2.2 signal (Purpose 1) at boot, and a consent platform's answer takes precedence over a recorded decision. A choice made on the banner after the page loaded applies from the next page; call setConsent from the platform's callback to apply it on the page where it is made.

To gate the loader script and all network activity behind consent instead, mount with autoload: false and call widget.load() from your CMP's grant callback. See SDK → Deferred boot.

Your privacy policy

Your website is the controller of chat visitor data, Assistify processes it on your behalf. Two published notices describe the chat to your visitors in plain language:

Mention the chat in your website's privacy policy and link both notices from it (or from your cookie information). If your cookie banner implements TCF, the widget reads its signal at boot. Call setConsent from the banner's callback for a banner without TCF, and to apply a choice on the page where the visitor makes it.

For your data-protection records, the Data Processing Agreement you accepted at registration and the current sub-processor list are published at those URLs.

Clearing a visitor

Two primitives clear this stored identity:

  • reset() is the logout primitive: it wipes the server session, the cookie and its stored copies, unsent drafts, and the identity on the page, then re-boots anonymous. Call it on logout so the next visitor on a shared browser starts fresh.
  • destroy() is the teardown primitive (for example an SPA leaving a chat route): it stops the runtime but leaves storage intact, so a later mount() recognizes the returning visitor.

For the exact list of what reset() clears, see JavaScript API → reset().