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.

ToolWhat the server doesFinds the visitor byCredentials
GA4Sends a da_final event through the Measurement ProtocolGA client id, from the _ga cookieMeasurement ID, and an API secret from Admin › Data streams › your stream › Measurement Protocol API secrets
MixpanelSends a da_final event through /importMixpanel distinct idProject token and API secret, from Project settings
KlaviyoUpdates the da_* properties of a profile Klaviyo already has. Never creates oneKlaviyo's exchange id from the __kla_id cookie, else the identify() hash as the profile's External IDA private API key with Profiles: Full Access (read and write)
ShopifyTags the orderCheckout token when Double Agent has one, otherwise the cart tokenShop 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
StripeUpdates the PaymentIntent metadatastripe_piSecret key. Built, but not active: no part of the script sends the PaymentIntent id yet. See Stripe
Your endpointPosts a verdict.final eventnoneURL 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

ToolWhere to look
GA4Reports › Realtime, event da_final
MixpanelEvents, filter on da_final
KlaviyoThe profile's Custom properties, da_class
ShopifyThe order's tags in Orders
Your endpointYour 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.