When and How to Reset Visitor Context

Last updated: August 11, 2026

Reset Dynamic Context when stored visitor information must not carry into the next conversation.

When to Reset

Call resetContext() when:

  • A visitor logs out.

  • Another person may use the same browser session.

  • Account, company, or entitlement data becomes stale.

  • A form is cancelled and its submitted values should not be reused.

  • Your single-page application changes to a visitor journey that requires different context.

You do not need to reset immediately after a successful conversation creation. Docket clears the pending browser buffer after the backend acknowledges the context.

Reset the Pending Context

const result = await window.AISeller.resetContext();

if (!result.success) {
  console.warn("Docket context was not reset:", result.message);
}

resetContext() encrypts and stores an empty object. The next conversation is created without the previous visitor values.

Switch to a Different Visitor

Reset first, then set the complete context for the new visitor.

const resetResult = await window.AISeller.resetContext();

if (resetResult.success) {
  const setResult = await window.AISeller.setContext({
    name: "Morgan",
    company: "Contoso Research"
  });

  if (setResult.success) {
    window.AISeller.showAndConnect();
  }
}

Resetting does not rewrite or remove context from a conversation already in progress.

Verify the Reset

  1. Set documentation-only context and start a test conversation.

  2. End the conversation.

  3. Call resetContext() and confirm success: true.

  4. Start another conversation without setting new context.

  5. Confirm the agent does not reuse the previous visitor values.

Related Articles