Test attribution end to end on Cactus Inbound¶
Use Rose's demo site, Cactus Inbound, to check a conversion attribution change in real
browsers before or after merge: a chat on one site, a Rose CTA link to a sign-up on another
registrable domain (the setup of a client such as Shine: chat on shine.fr, sign-up on
login.shine.co), route changes, a sign-in round trip, then the conversion. Unit and faked
end-to-end tests (just e2e) cover the code; this checks the real widget, CDN, PostHog and
batch job together.
The test bench¶
| Part | Where | What it gives |
|---|---|---|
| Chat site | https://cactusinbound.com |
The production widget, Cactus Inbound's own config |
| Sign-up on another registrable domain | https://rose-demo-site.benoit-9dd.workers.dev |
The same site served by its Cloudflare Worker. workers.dev is on the Public Suffix List, so cactusinbound.com's cookies never reach it. It loads the test widget (cdn.userose.ai/widget/test) |
| Sign-up flow | /start → /start/sign-up?size=… → /start/thank-you |
In-app route changes (pushState). Continue with Google reloads the page without any rose_* parameter, like an OAuth return. Submitting calls InboundXWidget.trackFormSubmitted({ formId: 'cactus-signup' }) |
| Rose domain | rose-demo-site.benoit-9dd.workers.dev, a hidden Cactus Inbound domain |
Conversions counted there, chat never shown |
| Same registrable domain | landing.cactusinbound.com, www.cactusinbound.com |
Subdomains that share Rose's cookies with the chat site |
The site's code is the inboundx/rose-demo-site repository. It deploys by hand only
(npm run deploy there); its GitHub deploy workflow is disabled.
Steps¶
- Put the change on the test widget. Merge it to
develop, or run the widget deploy on the pushed branch:gh workflow run deploy-widget.yml --ref <branch> -f environment=test. The branch then replaces the shared test widget until a push todevelopthat touchesfrontend/sharedorfrontend/widget(or a run with--ref develop) puts develop's back. Check the CDN serves it:curl -s https://cdn.userose.ai/widget/test/inboundx-widget.js | grep -c <a string from the change>. - Point a CTA at the sign-up host (production config writes: every environment reads
one Supabase, so ask the operator first). Save Cactus Inbound's
ctasoverride, then write it with Decorate CTA links on and the English "Start Now" URL on the workers.dev host:cd backend && set -a && . ./.env.production && set +a rose-config get ctas --site cactusinbound.com --env production --json > /tmp/cactus-ctas-before.json # drop the banner line # /tmp/cactus-ctas-test.json: same ctas, "cta_link_attribution_enabled": true, # url.en = "https://rose-demo-site.benoit-9dd.workers.dev/start" rose-config set ctas --site cactusinbound.com --env production -f /tmp/cactus-ctas-test.json --yes - Run the journey in Chrome. On cactusinbound.com ask Rose how to sign up, click
Start Now: the sign-up opens with
rose_session_idandrose_visitor_idin its address. Choose a plan, click Continue with Google, fill the form and create the account. - Restore the CTA right away (see Restore below), so live visitors stop landing on the test host.
- Check the browser. The widget keeps the link under
inboundx_chat_link_v1in sessionStorage (full consent). Browser tools redact session ids: compare values inside the page (for example store the link's id inwindow.nameon landing, which survives reloads in the tab) rather than reading them out. - Check PostHog (project 80620,
execute-sql): the conversion and the chat share one session id.Then look up that tail's events onSELECT timestamp, properties.rw_environment AS env, right(toString(properties.rw_last_active_session_id), 6) AS chat_tail, properties.rw_client_id_from_link AS from_link FROM events WHERE timestamp >= now() - INTERVAL 1 HOUR AND event = 'rw_client_form_submitted' AND properties.$host = 'rose-demo-site.benoit-9dd.workers.dev'cactusinbound.com(rw_message_sent,rw_cta_clicked). - Check the stored row once the batch job has run: in
public.session_events, a conversion linked to a chat is stored under the chat'ssession_id, withevent_name = 'client_form_submitted'andproperties->>'had_conversation' = 'true'; an unlinked one keeps its own session andhad_conversationfalse. Bound the query onevent_at: an unbounded one hits the statement timeout. The production batch job runs production code: a backend change is only visible once released.
Restore the saved ctas override as soon as the journey is done. First check that the
live override still equals your test file (rose-config get ctas …); if someone edited it
meanwhile, restore only the two fields you changed. Leave the hidden domain registered for
the next test. If the test widget still runs your branch afterwards, rerun the deploy with
--ref develop.
Pitfalls¶
- The sign-up page's first
<select>is the locale picker: setting it switches the page to/frwith a full reload. Fill the form's own select. - The supabase MCP connector is read-only. Config writes go through
rose-config; anything else (a new domain) through the backoffice's Edit clients page or the service-role key.