Security Guidelines for Passing Visitor Context
Last updated: October 26, 2026
Dynamic context is encrypted before it leaves the browser, but encryption only answers one question: whether the data is protected in transit and storage. The other question is whether a field belongs in an AI conversation at all. This page covers both.
How does Docket protect pending context?
The widget encrypts the context object in the browser before storing it. It uses AES-256-GCM for the data itself and RSA-OAEP with SHA-256 to encrypt the generated key.
The encrypted payload is held in browser storage until Docket creates the conversation. Once the backend confirms the conversation, the widget clears it. If the request fails, the payload is kept so it can be retried.
Because it is browser storage rather than session-only storage, a pending payload survives closing the tab and reopening the browser. On a shared machine, that is the case for calling resetContext() at logout rather than relying on the session ending.
Which values should never be passed as context?
Passwords or authentication secrets
API keys, access tokens, or session tokens
Payment card or bank account details
Government identifiers
Private encryption keys
Internal notes the visitor should not hear repeated
Full records where a single flag or identifier would do
Where you can, send a derived value instead of the underlying data. hasPaymentMethod: true tells the agent what it needs without carrying anything sensitive.
How small should the payload be?
Include a field only if it changes how the agent behaves or saves the visitor from answering something twice. Four well-chosen fields usually beat a full CRM record.
const result = await window.AISeller.setContext({
accountId: "acct_12345",
plan: "Enterprise",
isCustomer: true,
region: "North America"
});Remember that the agent can repeat what it is given. The Context for Agent description on each variable is where you say how a value should be used, including when it should inform the answer without being said out loud.
What is different about URL context?
Values sent as ctx_ URL parameters are visible in a way JavaScript context is not. They appear in browser history, referrer headers, analytics tools, server logs and any screenshot of the address bar.
Use URL context for values you are comfortable seeing in those places, such as a campaign name or a plan tier. For anything else, call setContext() from your own page code.
How should you handle identity changes?
Call
resetContext()when a visitor logs out or a different person takes over.Send a complete context object for the new visitor rather than topping up the old one.
Do not assume a shared browser has forgotten the previous visitor.
Review the fields you send whenever your privacy or data-use policy changes.
What should you check before adding a new field?
The agent needs the field for a purpose you can name.
Your organisation or the visitor has authorised that use.
The variable description tells the agent how to handle the value.
The value is not a secret or a regulated identifier.
Your logs, analytics and URLs will not expose it somewhere unexpected.
Your logout and identity-change flows reset stale context.
Frequently asked questions
If context is encrypted, why does it matter what I send?
Encryption protects the data on its way to Docket. It does not decide whether a value is appropriate for an AI conversation, whether you have consent to use it, or whether the agent might repeat it to the visitor.
Where is the pending context stored?
In the browser, as an encrypted payload, until a conversation consumes it. It is not readable from your page code.
Is it safe to pass an email address?
Usually yes, and it is one of the most common fields. Treat it as personal data: pass it when the agent needs it, cover it in your privacy notice, and reset it when the visitor changes.
Can I pass an internal account ID?
Yes, and an opaque ID is often the better choice. It lets the agent reference the right account without carrying the underlying record.
What happens to context if the visitor declines cookie consent?
Consent handling is configured separately, and it affects what Docket may store durably. See Privacy and Consent for Docket Marketing Agent.