Bot visitor context
When a visitor opens a chat, the bot doesn't normally know what they were just doing on your site. Bot visitor context changes that — when the toggle is on, an identified visitor's recent pageviews, custom events, and session activity get appended to the bot's system prompt on every turn, so the bot can answer with awareness of what the visitor was actually looking at a minute ago. The same block is also dropped into the handoff email when a conversation escalates to a human, so the agent picking it up sees the same context.
This article assumes you already have Site Activity tracking turned on for the widget. If you don't, start with Site Activity tracking — there's no activity to inject if you're not recording it.
The setting lives at Widgets → [widget] → Privacy & Tracking, directly below the tracking toggle.
How to enable
- Open Widgets, click the widget you want to configure, and scroll to the Privacy & Tracking card.
- Make sure Tracking is on. The visitor-context switch right below it is greyed out and unclickable as long as tracking is off — there's nothing for the bot to read from a widget that isn't recording anything.
- Flip Use recent activity in bot replies on. The change saves immediately and is recorded in Team → Audit log.
Only admins and owners can change either toggle. Members can see them but the switches won't respond.
The toggle is per-widget, so you can turn it on for your highest-intent widget (typically the one on /pricing or your marketing site) without turning it on for everything. New widgets ship with this off by default — same as tracking.
What gets injected into bot replies
When the toggle is on, the conversation has an identified visitor (a Lead or Contact — not an anonymous visitor still browsing), and the visitor has at least one Site Activity event in the last 90 days, the bot's system prompt gets a new ## Recent Activity section appended for every turn of that conversation.
The block has three parts:
- Behavior summary — total sessions, total events (with a custom-event count called out separately), how long since the visitor's first touch, and how long since they were last seen, in relative terms ("12 min ago," "3 days ago").
- Top pages — up to three URLs the visitor has hit most often, with view counts.
- Recent events — the last five events with relative timestamps. Pageviews include the URL; custom events include the event name; identify and session-start events are noted.
The block starts with framing language that tells the bot to use the activity as background — to acknowledge what the visitor was just looking at, or reference recent custom events — but not to recite the activity back verbatim. The bot is meant to sound aware, not surveillance-y.
Here's what the block looks like in a real conversation. Imagine a visitor named Jess who's been on your pricing page twice in the last hour and fired a clicked_upgrade custom event five minutes ago:
## Recent Activity
Recent site activity for the current customer (last 90 days). Use this to
make replies more contextual — e.g. acknowledge what the user was just
looking at, or reference a custom event they fired. Do not recite this back
to the user verbatim; use it as background.
### Behavior summary
- Total sessions: 3
- Total events: 14 (2 custom)
- first seen 6 days ago
- Last seen: 5 min ago
### Top pages
- /pricing (4×)
- /features/automation (2×)
- / (1×)
### Recent events
- 5 min ago — custom event clicked_upgrade
- 7 min ago — pageview /pricing
- 12 min ago — pageview /features/automation
- 18 min ago — pageview /pricing
- 18 min ago — session started
In a chat, the bot might respond to "What's the difference between Growth and Scale?" with something like "Happy to walk through that — looks like you were just on the pricing page, so I'll keep it concrete..." instead of a generic explainer. The same visitor in a no-context conversation gets the generic explainer.
Handoff email enrichment
The same toggle controls a second thing: when a conversation gets escalated to a human (the bot fires a handoff directive, the visitor asks to speak with a human, etc.), the email sent to the assigned agent or channel includes the same recent-activity block as a plain-text section in the body.
So the agent picking up the conversation already sees "this user has been on /pricing 3 times in the last hour, fired clicked_upgrade 5 min ago" before they click into the inbox. No digging through the timeline to figure out who they're about to talk to.
One toggle, two effects — the bot reply path and the handoff email path both read from the same source. You don't see the split in the UI; turning the toggle on enables both.
Token cost
The activity block runs roughly 200–500 tokens per conversation depending on how active the visitor has been. It's billed against the bot's normal Claude spend on the first turn of each new conversation — Anthropic's prompt caching means follow-up turns within the same conversation pay near-zero on the activity block.
You'll see the cost on Analytics → Claude Spend as part of your per-conversation cost. For a busy bot at around 1,000 conversations per day with the toggle on across all of them, expect a few cents per day in additional spend. For most tenants this is rounding error against the rest of the bot bill; for high-volume low-margin chat, it adds up — see the next section.
(For database-poking customers: the per-run token count is recorded on bot_runs.visitor_context_tokens, round-0-only, mirroring the prior-conversations memory column.)
When to enable
Enable it for:
- B2B SaaS with a high-intent funnel where pricing-page browsing or comparison-page browsing meaningfully predicts what the visitor wants to talk about. The signal-to-noise is high.
- Tenants with custom events that fire on important moments —
clicked_upgrade,viewed_demo,started_trial, etc. The behavior summary makes those moments visible to the bot, which lets the bot reference them naturally. - Bots whose replies feel too generic. If your bot's answers read like they could come from any visitor on any page, adding context can sharpen them without changing the persona or behaviors.
Don't enable it for:
- High-volume, low-margin chat bots where the per-message token cost matters at scale. The extra spend is small per conversation but compounds.
- Tenants who haven't set up custom events yet and whose only Site Activity events are pageviews. Without high-signal custom events, the bot context is just "they looked at pages," which usually doesn't change the reply quality enough to justify the tokens.
The honest move is to try it on your busiest one or two widgets first, see whether bot replies actually get sharper and whether your handoff emails feel more useful, then decide whether to roll it out further. The toggle is per-widget specifically so you can experiment without committing tenant-wide.
Frequently asked questions
Does the context block ever get injected for anonymous visitors? No. The block only goes in when the conversation has an identified customer record — a Lead or a Contact. Anonymous chat sessions that haven't captured an email yet get no context block and no token cost. Once the visitor identifies (typically when the bot captures their email in a flow), context kicks in starting with the next turn.
What happens if I turn tracking off but leave this toggle on? The system fails closed — no context block gets injected because there are no events to query. The toggle value doesn't auto-reset, though, so if you later turn tracking back on, context resumes automatically. If you want context fully disabled, turn this toggle off explicitly.
Does the bot recite the activity back to the visitor? It's instructed not to. The block has framing at the top telling the bot to use the activity as background context, not to read it back verbatim. The bot might say "I see you were on the pricing page a minute ago" — that's the intended pattern. It shouldn't say "you visited /pricing at 18:14, then /features/automation at 18:18..." If you see that pattern, the bot's persona or behaviors may be pushing it toward over-disclosure; tighten the persona and it should settle.
Is there a webhook or audit trail for visitor-context use?
Not as a separate event. The toggle change itself is recorded in Team → Audit log as an "Updated widget" entry. Per-conversation token usage is recorded on the bot_runs row for each turn. There's no outbound webhook firing on "context was injected" — that's part of every bot turn already.
Does enabling this change handoff-email delivery to existing escalation rules? No. Handoff emails still route the same way they always did — to the assignee, or to the channel's default recipient if unassigned. The only change is that the email body has a plain-text Recent activity section in it when the toggle is on and the conversation has an identified visitor with recent events. If neither condition holds, the email looks exactly like it did before.
