Add hero CTA A/B test (hero_cta: control vs free_emphasis)

Sticky 50/50 variant assignment via gw_ab_hero cookie, server-rendered
so no flicker. Tracks exposures, CTA clicks, and booking conversions
to ab_events (table self-creates on first POST). Bot UAs are dropped;
exposures/clicks dedupe per session.

- ?ab=control / ?ab=free_emphasis forces and persists a variant
- /owner/experiments shows per-variant CVR and relative lift
- AB only runs on the marketing surface

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 08:14:18 +12:00
parent a7f8a619b1
commit 171b193498
14 changed files with 534 additions and 8 deletions
+15
View File
@@ -0,0 +1,15 @@
-- A/B test event log. One row per exposure / cta_click / conversion.
-- Kept narrow on purpose: the goal is "did variant X get more conversions
-- than control" — not full session reconstruction.
create table if not exists ab_events (
id bigserial primary key,
experiment text not null,
variant text not null,
event_type text not null check (event_type in ('exposure', 'cta_click', 'conversion')),
anon_id text not null,
meta jsonb not null default '{}'::jsonb,
created_at timestamptz not null default now()
);
create index if not exists ab_events_experiment_variant_idx
on ab_events (experiment, variant, event_type, created_at desc);