← Back to Skills

HypeSite hand-off — a service converts traffic that a HypeSite tested

A HypeSite runs the A/B-tested landing pages. A Tawa service (here `personaldatatrust`) holds the real site where people pledge, write letters, sign up. The…

Commandplatform

About

A HypeSite runs the A/B-tested landing pages. A Tawa service (here `personaldatatrust`) holds the real site where people pledge, write letters, sign up. The HypeSite's calls to action go through **`/_hs/go`**, which appends a signed **`hs_ref`**; the service posts each conversion step back to the portal, which counts it against the right variant.

Skill Content

This is the raw markdown that gets installed as a Claude Code command.

---
name: tawa-hypesite-handoff
description: "HypeSite to service hand-off: /_hs/go, signed hs_ref, conversions, SITE_SERVICE_CLIENTS service door, noindex and redirects. Use when a Tawa service converts traffic from a HypeSite."
---

# HypeSite hand-off — a service converts traffic that a HypeSite tested

## The Short Version

A HypeSite runs the A/B-tested landing pages. A Tawa service (here `personaldatatrust`) holds
the real site where people pledge, write letters, sign up. The HypeSite's calls to action go
through **`/_hs/go`**, which appends a signed **`hs_ref`**; the service posts each conversion
step back to the portal, which counts it against the right variant.

```
mylifemydata.org/own  ──CTA──►  /_hs/go?to=https://personaldatatrust.org/#pledge
                                   │ appends hs_ref (+ utm_*), 302
                                   ▼
personaldatatrust.org  ── pledge ──►  POST {PORTAL_URL}/api/sites/public/conversions { hs_ref, step }
                                   ▼
portal experiment results: variant "own", step "pledge" +1
```

Built for MARKETING-59 (insureco/personaldatatrust, iec-portal#1377/#1379/#1380,
hypesites#54/#56). The full contract is `docs/contracts.md` in insureco/personaldatatrust.

## 1. `/_hs/go` and `hs_ref` (hypesites)

- `GET /_hs/go?to=<absolute https url>`. `to`'s host must be on hypesites' **`HS_GO_HOSTS`**
  (exact hosts, comma list). Anything else → 400.
- Appends `hs_ref` and the landing page's `utm_*` (from the Referer; defaults
  `utm_source=<site slug>&utm_medium=hypesite&utm_content=<variant or path>`), never overwriting a
  param already on `to`, then 302.
- On every served page, links starting with `/_hs/go` get `hs_x`, `hs_xv`, `hs_view`, `hs_p`
  (experiment, variant, view, path) added, so the handler knows the context. Write CTAs as plain
  `href="/_hs/go?to=…"`; URL-encode `to`, fragments included (`%23pledge`).
- Token: `v1.<b64url(JSON {s,x,v,k,w,p,i,e})>.<b64url(HMAC-SHA256(key, "v1."+payload))>` with
  `key = HMAC-SHA256(HYPESITES_KEY, "hs_ref:v1")`, 30-day expiry. `k` (visitor key) is null without
  consent. A receiving service never holds the key; it asks the portal.

## 2. Portal service door (`SITE_SERVICE_CLIENTS`)

A service's own Bio-ID `client_credentials` token (org `insureco`) whose `client_id` is on the
portal's **`SITE_SERVICE_CLIENTS`** (`client:slug|slug,client2:slug`) may call, for the listed sites:

| Route | Does |
|---|---|
| `POST /api/sites/public/hs-ref/verify {hs_ref}` | `{valid, ref}` or `{valid:false, reason}` |
| `POST /api/sites/public/conversions {hs_ref, step}` | records `step` as an exposure event (first occurrence only, so idempotent); `{recorded, reason?}` |
| `POST /api/sites/public/letters/{slug}/lookup` and `/submit` | the letters engine, as hypesites calls it; `x-site-client-ip` sets the rate-limit IP |
| `POST /api/sites/service/{slug}/crm-lead` | a jci-brain site-lead candidate, idempotent on `signupId` |
| `GET /api/sites/service/{slug}/submissions?alias=` | a site's submissions (one-time migrations) |
| `POST /api/sites/service/{slug}/zip-regions` | ZIP → state/county |

An experiment counts a service-side step by having a ladder step `{ "event": "<step>" }`.
Ladder **keys** use lowercase letters, digits and hyphens (`pledge-optin`); the **event** names
can be anything (`pledge_optin`). Visitors without consent have no visitor key, so their
conversions come back `recorded: false, reason: "no_visitor"`.

## 3. A console that acts as the person (forwarded person)

The portal's site staff routes (`siteEditor({ slug })`: experiments, versions, publish, rollback,
interest, and the letters admin routes under `/api/sites/{slug}/letters/…`) also accept a person
forwarded by an allowlisted service:

- `Authorization: Bearer <service token>` (client on `SITE_SERVICE_CLIENTS` for that slug), and
- `x-forward-user: Bearer <the person's own access token>`, whose `aud` includes the calling
  client, which is a user token (no `act`, no persona, not delegated), and whose person is staff.

**Letter-batch approve and hold work only this way or with a portal cookie session.** A service
token alone, a persona, a `tawa session` token (`act`) or a token minted for another client is
refused. iec-civic's staff routes follow the same pattern with `STAFF_SERVICE_CLIENTS` and
`STAFF_AUDIENCES`. Never a blanket service key.

## 4. HypeSite per-page noindex and redirects

- **noindex a page**: put `<meta name="robots" content="noindex">` in the artifact. The portal
  leaves it out of the sitemap and hypesites also sends `X-Robots-Tag: noindex`. Leave the home page
  indexed with its self-canonical.
- **Redirect a moved page**: unmount it from the site and mount an artifact at `/hs-redirects`
  holding `<script type="application/json" id="hs-redirects">{"redirects":[{"from":"/letter","to":"https://personaldatatrust.org/letter","status":301}]}</script>`.
  `to` may be an absolute https URL; the request's query string is appended. Rules fire only for a
  path that would otherwise 404, so the page must be unmounted. Publish the site.

## Common mistakes

- Moving a page by redirect while it is still mounted — the page wins and the rule never fires.
- `to` not URL-encoded, so `#pledge` is dropped before `/_hs/go` sees it.
- Expecting the receiving service to verify `hs_ref` itself — it has no key; call the verify route.
- Ladder keys with underscores — refused (`use lowercase letters, digits and hyphens`).
- A console calling the portal with only its service token for an approval — refused by design.

Install

Copy the skill content and save it to:

~/.claude/commands/tawa-hypesite-handoff.md
Download .md

Coming soon via CLI:

tawa chaac install tawa-hypesite-handoff

Details

Format
Command
Category
platform
Version
1.0.75090
Tokens
~1,394
Updated
2026-11-25
platformhypesitesexperimentslettersportalservice-doorconsole