File DA-044 View as Markdown
Relabel
The browser labels a visitor on the page. Sometimes the server knows better later, for example when it verifies an agent the browser could not. Relabel lets the server correct the label in your tools itself: GA4, Mixpanel, Klaviyo and Shopify orders. You give it credentials once.
Before you start: a public key on the snippet (only keyed traffic is relabelled, see Capabilities) and the Owner or Admin role on the site.
Set it up
Open Sites › your site › Settings › Server relabel credentials and fill in the tools you use. The credentials are write-only: the portal never shows them again, and saving replaces them.
| Tool | What the server does | Finds the visitor by | Credentials |
|---|---|---|---|
| GA4 | Sends a da_final event through the Measurement Protocol | GA client id, from the _ga cookie | Measurement ID, and an API secret from Admin › Data streams › your stream › Measurement Protocol API secrets |
| Mixpanel | Sends a da_final event through /import | Mixpanel distinct id | Project token and API secret, from Project settings |
| Klaviyo | Updates the da_* properties of a profile Klaviyo already has. Never creates one | Klaviyo's exchange id from the __kla_id cookie, else the identify() hash as the profile's External ID | A private API key with Profiles: Full Access (read and write) |
| Shopify | Tags the order | Checkout token when Double Agent has one, otherwise the cart token | Shop domain (your-store.myshopify.com), and the client ID and secret of a Dev Dashboard app with read_orders and write_orders (or an older app's Admin API token). See Shopify |
| Stripe | Updates the PaymentIntent metadata | stripe_pi | Secret key. Built, but not active: no part of the script sends the PaymentIntent id yet. See Stripe |
| Your endpoint | Posts a verdict.final event | none | URL and secret, in Debrief webhook. See Debrief |
Each event carries the nine da_* fields (Verdict), plus da_sid, and on GA4 and Mixpanel da_provisional, the class the browser had.
When it runs
Only for keyed sessions that are not quarantined, and only when the server's label differs from what the tool already has. The first time, that means the server disagrees with the browser, for example when it verifies an agent the browser called human. After that, a tool hears again only when the class, the behaviour label or the authorization decision changes. Calling check() on every page does not repeat a relabel, and two requests with the same verdict at the same time relabel once.
A tool is skipped when the session has no id to find the visitor by, for example GA4 without a _ga cookie. /v1/evaluate calls carry no browser ids, so from them only the Debrief webhook goes out.
Tools run in parallel and one failure never blocks the others. A network error, a 429 or a 5xx is retried, up to 5 attempts in all over about 7 minutes. Any other error is final. A relabel that never succeeds is not counted as sent, so the next verdict for that session tries again.
Shopify order tags
The order gets doubleagent:bot or doubleagent:agent, doubleagent:agent:<family> for a known agent (for example doubleagent:agent:openai), and doubleagent:behavior:friendly, neutral or rogue. A relabel to human removes the class and agent tags. The order usually does not exist yet when the verdict changes mid-checkout, so a missing order is retried like a network error.
Shopify keeps the cart token on the order, which is how the server finds it. The browser's verdict also reaches the order as _da_* cart attributes (see Shopify).
Check it worked
| Tool | Where to look |
|---|---|
| GA4 | Reports › Realtime, event da_final |
| Mixpanel | Events, filter on da_final |
| Klaviyo | The profile's Custom properties, da_class |
| Shopify | The order's tags in Orders |
| Your endpoint | Your server's log |
A normal visit by a person sends nothing, because the browser's label is already right. To see a relabel, set up the Debrief webhook too: when a delivery has data.provisional different from data.verdict.class, the tools that have an id for that session were relabelled at the same time.
Next: Debrief to get the same event on your own server.