Simulation
Agent handoff
A simulated visitor assistant asks for a guide. This site answers with schema.org JSON and one real page. Keyword rules only.
Understanding the labHow to use it and why you'd want to
Why you'd want to
A question is matched to the first keyword list, and the result is a schema.org object for a real page on this site. After Accept the page queues lab_interaction with the rule id.
How to use it
- Type a question. Matching is lowercase keywords, not a model.
- No match comes back as empty fields.
- A match attaches a schema.org object for one real page.
- After Accept, the queued value is the rule id.
Simulation. A keyword rule answers. The question is not stored and is not sent to a model.
Exchange
Visitor assistant to site agent
No exchange yet.
Why am I seeing this? The match is the first keyword list that appears in the question: beginner, measurement, personalization, or help. Anything else is no match. The JSON uses schema.org types and a real URL on this site.
WalkthroughHow we built itShowHide
Example vendor setup is marked below. eVar and event numbers are examples. This lab does not call Adobe.
The agent handoff lab matches a question to the first keyword list and builds a schema.org object for a real page on this site. After Accept it queues lab_interaction, and the lab does not call Adobe.
Lowercase the question
answerQuery lowercases the text and finds the first rule whose word appears in it. The lists are beginner, measurement, personalization, and help.
Return no match as nulls
When no word hits, the answer is rule null, href null, name null, and jsonLd null. The page says no page was chosen.
Attach a schema.org object
A match copies the rule id, the path, and the page name. jsonLd uses the rule type, LearningResource or ContactPage, and a URL on this site.
Queue the rule id after Accept
Opening the page calls useLabView, which queues lab_interaction with action view and label page. Asking calls trackLab with the rule id, or no-match. pushEvent returns before consent is granted.
From the code
The first keyword list wins. The JSON points at a page on this site.
export function answerQuery(query: string): HandoffAnswer {
const text = query.toLowerCase()
const rule = handoffRules.find((item) => item.words.some((word) => text.includes(word)))
if (!rule) return { rule: null, href: null, name: null, jsonLd: null }
return {
rule: rule.id,
href: rule.href,
name: rule.name,
jsonLd: {
"@context": "https://schema.org",
"@type": rule.type,
name: rule.name,
url: `https://www.blackboxpersonalization.com${rule.href}`,
isAccessibleForFree: true,
},
}
}Ask runs the matcher, then queues the rule id.
const [runs, setRuns] = useState(0)
const results = useResultHighlight<HTMLDivElement>()
function ask(text: string) {
const next = answerQuery(text)
setQuery(text)Google and Adobe
Google queues lab_interaction after Accept. Adobe is an example of the same fields.
Queued only after Accept. The page view queues lab_interaction with action view and label page. A question queues the same event with action run_demo and label set to the rule id, or no-match. Register lab_id, action, and label as event-scoped custom dimensions. This site does not call gtag('set') or Adobe.
Simplified shape of the object queued after Accept. Register any new parameter as an event-scoped custom dimension. This site does not call gtag('set').
dataLayer.push({
event: "lab_interaction",
lab_id: "agent-handoff",
action: "run_demo",
label: "beginner",
})Example implementation. This site does not call Adobe. eVar41, prop41, and event41 are example variable numbers. In Launch, a data element reads the value and a rule sends it when the value changes. In the report suite, enable eVar41 with Most Recent allocation and expire it on the hit. A processing rule is unnecessary if the data element maps straight to that eVar.
Example alloy payload. _example is a placeholder schema, not a real tenant.
alloy("sendEvent", {
xdm: {
eventType: "web.webinteraction.linkClicks",
_example: {
handoffRule: "beginner",
},
},
})Example hit. eVar41 is hit-scoped in this example. prop41 dies at the same hit.
s.eVar41 = "beginner"
s.prop41 = "beginner"
s.events = "event41"
s.linkTrackVars = "eVar41,prop41,events"
s.linkTrackEvents = "event41"
s.tl(true, "o", "lab_interaction")Translation
Each lab field, the GA4 name, and the example Adobe variable. Scope is the part that usually gets lost in the translation.
Rule id
GA4. label on lab_interaction when action is run_demo. Values include beginner, measurement, personalization, help, and no-match.
Adobe. Example eVar41, expire on the hit.
Scope. Event. A user-scoped rule would keep the first question onto later visits.
Action
GA4. action is view for the page, or run_demo for a question.
Adobe. Example prop41 on the hit.
Scope. Event. It names this interaction, not the visitor.
Chosen path
GA4. Not sent. The href stays in the JSON on the page.
Adobe. Example eVar41 if you sent the path. This lab sends the rule id in label instead.
Scope. Hit, if you tracked the path. The queued label is the rule, not the URL.
Question text
GA4. Not sent. The matcher reads it in the browser and drops it.
Adobe. Example: do not write the question into prop41.
Scope. Not a hit and not a user property. It is not stored.
Recommended next
Why these picksReading path transitions…