Advanced architecture
Edge A/B testing
Edge middleware can pin a visitor to a bucket before the page renders. This lab shows that split, then a Bayesian probability that one arm is ahead. Add example visits and conversions and the probability moves. The counts are not this site's traffic.
Example data, not real traffic.
Production would assign the bucket in edge middleware and store real impressions. This page only demonstrates the split and the math.
Understanding the labHow to use it and why you'd want to
Why you'd want to
You want the bucket and the odds visible before you trust a winner. The counts are examples, and adding a visit only changes this page.
How to use it
- Read which bucket a key lands in.
- Add an example visit or conversion.
- Watch the probability that B is ahead.
Loading the lab…
WalkthroughHow we built itShowHide
Example vendor setup is marked below. eVar and event numbers are examples. This lab does not call Adobe.
assignBucket hashes a key into arm A or B. probabilityBAhead draws 800 seeded Beta samples and returns the share where B is higher. The starting counts are examples.
Hash the key into a bucket
A 33-based hash of the key is even for A and odd for B. The same key always lands in the same arm.
Start from example counts
The page begins at fixed impressions and conversions and labels them as example data.
Recompute the probability
Each added example visit or conversion calls probabilityBAhead again with the same seed.
From the code
The bucket is a parity check on a hash.
return hash % 2 === 0 ? "a" : "b"Eight hundred seeded draws. B wins when its draw is higher.
if (betaDraw(armB.impressions, armB.conversions, random) > betaDraw(armA.impressions, armA.conversions, random)) wins += 1Google and Adobe
Google queues advanced_lab_view after Accept. Adobe is an example of the same fields.
After Accept, this lab queues advanced_lab_view. The demo payload stays on the page. This site does not call Adobe.
Simplified shape of the object queued after Accept.
dataLayer.push({
event: "advanced_lab_view",
lab_id: "edge-ab-testing",
})Example implementation. This site does not call Adobe. eVar164, prop164, and event164 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 eVar164 with Most Recent allocation and expire it on the hit.
Example alloy payload. _example is a placeholder schema, not a real tenant.
alloy("sendEvent", {
xdm: {
eventType: "web.webinteraction.linkClicks",
_example: {
exampleArm: "b",
},
},
})Example hit. eVar164 is hit-scoped in this example.
s.eVar164 = "b"
s.prop164 = "b"
s.events = "event164"
s.tl(true, "o", "advanced_lab_view")Translation
Each lab field, the GA4 name, and the example Adobe variable. Scope is the part that usually gets lost in the translation.
Lab id
GA4. Parameter lab_id on advanced_lab_view.
Adobe. Example eVar, expire on the hit.
Scope. Event. It names this lab, not the user.
Demo value
GA4. Not sent. Scores, proofs, and payloads stay on the page.
Adobe. Example prop. Do not copy the demo value.
Scope. Local state. It is not a user property.
Example counts
GA4. Not sent. Labeled example data is not a metric.
Adobe. Example event. Not sent.
Scope. A figure on the page, not a hit.
Consent
GA4. The view event is skipped until Accept.
Adobe. Example: skip the hit while consent is off.
Scope. A gate on the hit.
Recommended next
Why these picksReading path transitions…